First you have to find out WHY he's barking and then do something to correct either the cause or the behavior. For example, if he's barking because he's bored or lonely, go play with him or take him for a walk. If he's barking because someone is walking in front of the house or he sees a cat, do something to distract him from that and don't forget to praise and reward him when he does something good.
If he/she's old, just talk louder. Otherwise, get really close to it and look all mad. If it doesn't stop, get a high pitched thing, and if THAT doesn't work, get a shock collar or a squirt collar. Make sure that the shock collar will only startle him/her, not hurt.