How to Stop Your Dog from Barking at Strangers
To stop your dog from barking at strangers, let it bark 3-4 times, then stand over it and calmly give it the command, “Quiet.” Go to your dog and gently hold its muzzle closed with your hand and say “Quiet” again, then release its muzzle and step back. Call the dog to you and command it to sit, then reward it with a treat if it remains seated and quiet. Repeat the commands if it is still barking.
Recognize the causes of your dog’s territorial barking. Often, dogs who bark at strangers are demonstrating territorial barking. This type of barking occurs because your dog is fearful and sees strangers as a potential threat. Dogs are wired to defend their territory, so they will use their bark when they detect unknown people in familiar places like their homes and their yards. In fact, your dog may be so motivated to bark at the perceived threat that he may ignore your shouts to stop barking or any scolding you might give him. Even if you use harsh punishment to stop your dog from barking, it may escalate to the point that he might try to control his territory other actions, such as biting someone. Some dogs also bark at strangers to alert their owners to a potential threat. Alarm barking is triggered by sights and sounds. Dogs who alarm bark may react to strangers even when they are not in their home or yards. Your dog may bark when he sees strangers in the park, on the street, or in an unfamiliar place. Don’t yell or shout at your dog for barking. Most canine experts agree that yelling, scolding, or even hitting your dog for barking can in fact make his barking worse. If your dog is barking out of fear or anxiety, punishing him will only add to his stress. Instead, you need to train him to respond to strangers in an appropriate way, and to only bark when necessary. We bred dogs to bark, so do not get upset if your dog barks at sudden sounds like car doors slamming and loud noise in the street. However, dogs who bark at strangers require training to ensure they do not become too aggressive towards others. Avoid depending on a muzzle to stop your dog from barking. Some dog owners may consider using a muzzle to curtain their dog's barking. Often, anti bark collars are a form of punishment for your dog that should be a last resort, not a first option. Anti bark collars and muzzles are not as effective as training your dog properly and can lead to other behavioral issues. Obscure your dog’s view of strangers at the door. It's important that you manage your dog's barking by creating an environment that will limit his sight of others. Keep your curtains or blinds closed during the day when your dog is home. You can also set up a baby gate so your dog cannot get into rooms that have large bay windows where he can see outside. For a more permanent option, place a removable plastic film or spray a glass coating on the windows so its harder for your dog to see people outside. Doing this will limit your dog's ability to see people so he is less motivated to defend his territory and bark. Secure your yard with a tall fence. If your dog enjoys running around outside in the yard, place a tall fence around the yard to your dog cannot see strangers across the street or in the neighborhood. This will give him less of a need to bark and allow him to play without being distracted by strangers. The fence will also obscure your dog's view of the street when he is inside, so he won't be able to spot strangers and bark at them. Distract your dog from barking by shaking a set of keys. The sound should startle your dog and cause him to stop barking. Then, call him away from the door or the window and command him to “sit”. Give him a treat and then tell him to “stay”. If he remains seated and quiet, give him treats for the next several minutes until the stranger is gone. If he starts barking again after he is seated, shake the set of keys again and repeat the sequence. Avoid encouraging your dog to bark at people at the door by saying “Who's there?” to your dog and then walking to the door. This will cause your dog to be on guard and will likely lead to alert barking. Use the “quiet” technique by holding your dog’s muzzle. This technique will teach your dog that he is allowed to bark when someone comes to the door until you say “quiet”. Your dog should bark no more than three to four times and then stop when you calmly give him the command: “quiet”. Practice this technique when a stranger comes to the door, for example, a delivery man. Let your dog bark three to four times. Then, stand over him and say “quiet”. Go to your dog and gently hold his muzzle closed with your hand. Then, say “quiet” again. Release your dog's muzzle and step back from him. Then, call him away from the door or the window by saying his name and “here”. Command your dog to sit and then reward him with a treat. If he remains seated and quiet, give him several more treats for the next several minutes until the stranger is gone. If your dog starts barking once he sits down, repeat the sequence again and do not reward him until he sits and remains quiet. Try the “quiet” technique without holding your dog’s muzzle. If you feel uncomfortable holding your dog's muzzle or if you feel doing so might scare him, try the “quiet” method without holding him. Allow your dog to bark three to four times. Then, approach him and say “quiet”. Encourage his silence by feeding him pea-sized treats like cooked chicken, hot dogs, or pieces of cheese. Repeat this sequence several times over a period of several days until your dog seems to understand what “quiet” means. Your dog should stop barking once you say “quiet”. After several days of training, extend the time between giving the cue “quiet” and giving your dog his reward. Say “quiet” and wait two seconds before feeding your dog his treats. Gradually increase the wait time to five seconds, then 10 seconds, then 20 seconds. Work up to 30 seconds of wait time before rewarding your pup. Use treats to prevent your dog from barking during a walk. If your dog tends to bark at strangers when he is outside of his home, you can distract him from barking by using special treats that are soft, like cooked chicken, cheese, or hot dogs. Learn to read his body language and the cues that indicate when he is about to bark. This differs from dog to dog but may include: his hackles rising, ears pricking, or a change in the way he walks. When you notice these changes then distract him before he barks. Hold the treat in front of his nose so he can see the treat. Instruct him to nibble the treat as he is walking past a person who might cause him to bark. You can also command your dog to sit and eat the treat as people pass by him. Always praise him and reward him again if he does not bark as people pass by. Introduce your dog to people during your walk if you're in a calm environment so they get used to being around a variety of ages, ethnicities, and genders. Train your dog to ride in a crate if he barks in the car at strangers. Some dogs tend to bark while riding in the car and can feel anxious or fearful of strangers on the street or in other cars. Keeping your dog in the crate during a drive will restrict his view and give him less cause to bark. If your dog isn't comfortable riding in a crate, you can train your dog to wear a head halter in the car. A head halter can have a calming effect on your dog. You can also put a head halter on your dog during walks or around the house if he tends to bark. But you should avoid depending solely on a head halter to stop your dog's barking. A more permanent solution to the problem is training your dog not to bark at strangers. Take your dog to a professional dog trainer if he continues to bark. If you try several training techniques and reduce your dog's exposure to triggering sights and sounds, but he continues to bark at strangers, it may be time to speak to a professional dog trainer for guidance. The trainer can meet with you and your dog and conduct one on one training sessions and help you find ways to stop your dog from excessive or unnecessary barking. A listing of certified dog trainers can be found here. 
Recognize the causes of your dog’s territorial barking. Don’t yell or shout at your dog for barking. Avoid depending on a muzzle to stop your dog from barking. Obscure your dog’s view of strangers at the door. Secure your yard with a tall fence. Distract your dog from barking by shaking a set of keys. Use the “quiet” technique by holding your dog’s muzzle. Try the “quiet” technique without holding your dog’s muzzle. Use treats to prevent your dog from barking during a walk. Train your dog to ride in a crate if he barks in the car at strangers. Take your dog to a professional dog trainer if he continues to bark. 