Sometimes dogs just don't know when to pipe down. And that's OK, because barking and whining are the only ways your dog has to communicate. When he's running his mouth, though, a simple command can make him clam up -- you just have to teach it to him first.
Listen to your dog when he speaks to you. Remember that a bark or a whine is a message, so pay attention to your dog's triggers. For example, maybe he whines whenever you haven't paid attention to him in a while, or he barks when a stranger comes over. Once you know his triggers, you can figure out what he's communicating, like fear or boredom.
Ignore attention-seeking noise. While you may think that all noise is attention-seeking, the truth is that sometimes your dog makes noise just to get a reaction out of you, even a negative one. For example, if your dog sees that you're more invested in watching a football game than in playing, he might whine for your attention. When you look at him and yell, then you're giving him exactly what he wanted -- you think it's scolding, but he thinks it's reward. When your dog begs for your attention, don't give it to him. Instead, wait until he gives up, and then lavish him with praise and attention. Eventually he'll learn that making noise doesn't get him results, but being quiet does.
Teach your dog to speak. Sure, this might seem counterproductive, but to teach him to be quiet, you have to teach him to speak up. For one thing, he learns that barking is a behavior he should be prompted for, like rolling over or shaking hands. For another, he learns the command that teaches him to pipe down. Since you know what triggers your dog to bark, give a command like "speak" and trigger him. This may mean, for example, ringing the doorbell when you say "speak." Don't reward him for that, but when you start giving the command without triggering him with something else, reward him -- he has learned what the "speak" command means, and all he needs to bark is for you to say the word.
Teach him to stop. Even a dog who knows the "speak" command will sometimes bark at external factors, like a cat outside the window, so condition him to stop. You can do this two different ways, the first of which is interrupting him with a loud, calamitous noise. Make a startling sound, like slamming a drawer or dropping a tin can full of coins. His train of thought now lost, distract him with something new, like throwing a toy. While this may condition your dog not to bark, lest he hear the startling noise, it can just as easily be a temporary solution to a long-term problem. For that reason, you must also teach him the "quiet" command.
Focus on the "quiet" command. Your dog has learned that barking on command yields praise, so you have to teach him the same for quieting down. Once you have him barking, give the "quiet" command. Since he doesn't know the meaning of that word, you may have to keep repeating it until he tires of barking on his own. Once he does, though, lavish him with praise and give a treat. Then, get him to bark and subsequently quiet again and again, until he starts making the connection between the word "quiet," actually stopping barking and getting a reward.
Tom Ryan is a freelance writer, editor and English tutor. He graduated from the University of Pittsburgh with a degree in English writing, and has also worked as an arts and entertainment reporter with "The Pitt News" and a public relations and advertising copywriter with the Carnegie Library of Pittsburgh.