Barking is a dogs primary means of communication along with whining and howling. They bark to tell us something. They're hungry or need to relieve themselves. They may want to alert us to something they consider to be a threat or simply to get our attention out of loneliness or boredom. They may even be hurt or in some sort of danger. For these reasons we never want to totally stop a dog from barking. The key is teaching him when and under what circumstances barking is acceptable and when it is not. The problem is that barking to excess can easily become a bad habit. You need to investigate the cause of the barking and address the issues as soon as possible to correct the situation before the behavior becomes a habit.
Naturally, the first step is to check that all your dogs needs, both physical and mental are being met. Is he getting enough exercise and adequate toilet breaks. Fit dogs require more than a short stroll twice a day to meet their exercise requirements. These vary among breeds so check what is appropriate for your dog and see that these needs are met. An aging Newfoundland won't need a fraction of the exercise required for an Australian Shepherd in the prime of life.
In addition to physical exercise every dog needs to have enough mental stimulation to prevent boredom. Games and training sessions of a few minutes a couple of times per day go a long way to making a dog's life more interesting and cutting down on the tendency to development a problematic barking behavior. Remember that all dogs are essentially pack animals and crave company. You are probably the most important thing in the world to your dog so don't deny him the pleasure of you company. Spend time playing or training or simply hanging out together to keep him happy. Loneliness is a terrible thing for any of us, including our four-legged family members.
If you've met all your dog's needs and he continues to bark you'll need to check elements in the environment that might be contributing to the problem. A fence he can see through may allow him so much visual contact with things that go on outside that he's always overexcited. Chain link is a very effective way to keep a dog inside but you may have to install the privacy slats to cut down on what he can see and be excited by. Remember that most dogs are very territorial and he feels a responsibility to defend his area against any intruder. This translates in his mind to anyone he sees passing by the area he's enclosed in. He considers barking to be his job. A high and solid fence will work wonders to keep most dogs quiet.
If he loves a certain game or activity try to make time to share it with him.
No matter how tempting it is to think that 'speaking,' or barking to ask for a walk or a treat is cute do not encourage this. Only reward your dog with his treat or your attention or whatever the case may be when he is quiet. Make him do something for you before you do something for him. Ideally, obeying the Sit command or going to fetch his lead rather than barking as this leads him to associate barking with reward. Never a good idea!
If you've done all you can and still have a problem barker you may need to employ a training collar. Some emit a strong scent of citronella when triggered by barking. Others make a loud noise that dogs strongly dislike. These can be effective but shock collars are definitely not recommended. You can also use a water pistol to spray a weak solution of vinegar water or a can to pebbles which you shake when he begins to bark to draw his attention away. The timing is important here as you must act the moment he begins to bark. He needs to be unaware that you are the cause of the noise or the spray or he will continue to bark when you're not there.