Prevent the dog from being exposed to the things that trigger him to bark. You should block access to windows, and cover them so he can't see out. Play background music to mask outside sounds, change the sound of your doorbell, and bring him in from the yard whenever he barks.
Counter Conditioning Instructions Number 1: If the dog continues to bark despite your efforts to block his exposure to things, teach him that when someone comes to the door or passes by the property, he is permitted to bark until you say "Quiet." Allow him to bark 3-4 times, say "Quiet," (avoid shouting), go to the dog and gently hold his muzzle closed with your hand and repeat "Quiet," call him away from the door or window, ask him to sit, and give him a treat. If he stays beside you and remains quiet, continue to give him frequent treats for the next few minutes (until the stimulus is gone). If he resumes barking right away, repeat the sequence. Go through the same steps if the dog is barking at passersby from the yard.
Counter Conditioning Instructions Number 2: If the above procedure is ineffective after 10-20 attempts, allow the dog to bark 3-4 times, say "Quiet" (avoid shouting), and make a startling noise by shaking an empty soda can filled with pennies or a set of keys. He should react to the sound by stopping what he's doing. Call him away from the door or window, ask him to sit, and give him a treat. If he stays beside you and remains quiet, continue to give him frequent treats for the next few minutes (until the stimulus is gone). If he resumes barking right away, repeat the sequence. If this doesn't work after 10-20 attempts, you will need to seek assistance from a Certified Applied Animal Behaviorist, a Veterinary Behaviorist, or a Certified Professional Dog Trainer.
Counter Conditioning Instructions Number 3: If the dog barks at people and other dogs during walks, distract the dog with special treats before he begins to bark. Show the dog the treats by holding them in front if his nose (soft treats are best) and encourage him to nibble at the treats while he is walking along, past the person or dog who would normally cause him to bark. Some dogs do best if you ask them to sit as the person/dog passes by, while other dogs prefer to keep moving. Make sure you praise and reward the dog with treats every time he elects not to bark. - It may help to have the dog wear a head halter during occasions when the dog is likely to bark (on walks, in the home, etc.). Your dog should only wear the halter when you can supervise him. A halter can have a distracting and/or calming effect, and make him less likely to bark. Make sure you reward him for not barking. - If the dog is engaging in territorial barking primarily in the yard, keep the dog in the house during the day and supervise him when he is in the yard. - If the dog is engaging in territorial barking in the car, teach the dog to ride in a crate while in the car. This restricts the dog's view and may reduce his motivation to bark. If this is not feasible, try having the dog wear a head halter.