The first step to controlling your dog’s barking is to understand what the dog is trying to communicate.
Most of the barking that annoys the humans in the household falls into the warning category. Your dog is saying, “Danger! I don’t know this person / animal / situation.”
The next thing you need to know, then, is that the dog is simply doing her job. Your dog’s responsibility is to guard the house and its inhabitants. That means raising the alarm if something seems wrong.
What she needs you to do is to acknowledge that you’ve gotten the signal and that you’re in control. She needs you to say—by your actions more than your words, “Good dog! You’re doing a great job of guarding! You are telling me there is something dangerous out there. Thanks for letting me know! I’ll take it from here.”
The least effective thing you can do is to yell. Yelling sounds a lot like barking to a dog, so your dog may think that you’re just chiming in and also raising the alarm. Or the dog may think that you simply don’t understand. If that’s the case, she’ll keep barking—doing her job of protecting the household until someone else takes responsibility.
Do say “good dog!”—and give a treat if you have one handy. But the most effective thing you can do is to let the dog see that you are taking a look at the situation and taking responsibility for it. Your dog should feel relieved and proud to have done a good job.
I have seen this approach work over and over again with different dogs. We’ve even been able to use it during July 4 fireworks!