The short answer is, you can't stop your dog from barking, not totally anyway. It's one of the quickest and most effective ways to get your attention. You can however, learn to identify what he's actually saying.
Barking can indicate a range of things. Before you can address the problem, you need to establish WHY. Is your dog anxious, lonely, bored...or just excited? Just like people, dogs respond to stimuli (or lack of it) differently and our responses to their behaviour influences it significantly. In other words, dogs work out very quickly, what effect their behaviour can have. Let me give you an example. If a dog barks at the front door when someone knocks and the owners response is to yank him out the back and isolate him, he learns that someone visiting is a negative thing. This association may eventually lead to the dog biting someone. Alternatively, if the dog is told to sit and be quiet (perhaps with the use of a check chain) then praised for this good behaviour and the visitor is permitted to pat him, he's learning good manners, and that visitors are a positive thing.
Most obviously, barking is a warning, but it can also be a call to others to "come and play". You have said your dog "hears other dogs" which tends to suggest this may be the reason for his barking. He may simply be saying hello back, and indicating he would like to play with them. Does he go on lots of walks so he can socialize with other dogs and run off some energy? (9 months old is still very young, and little dogs are VERY energetic!) More exercise and new toys may help if this is the cause. Teach him some tricks and reward him generously with lots of pats and verbal praise.
You will certainly find the addition of The Beautiful Balancing Bach Remedy - Chill or Calm will help. (Calm if he's hyperactive and just being a puppy, Chill if the barking is more aggressive). The pre-mixed remedies can be added to the drinking water as well as given orally a few times a day. Anxious/nervous dogs also benefit from a Vit B complex supplement.
Remember, you need to determine WHY he's barking before you can modify the behaviour. (Apologies if your dog is a female, you didn't say)
Good luck. Let us all know how you go.
Wendy and Bernadette