There are a several reasons for a dog to cough. Each one may require Veterinary care to help your Boy.
Kennel cough is a very common reason. Sometimes Vets will prescribe a children's cough suppressant like Robitussin DM to help with the coughing and an antibiotic, but if this is Kennel Cough it can last as long as 2 weeks and then resolve itself. You can try taking your baby into the bathroom and steam it up this way the steam may help the congestion.
Internal parasites can also cause coughing. Round worms and Heart Worms are the biggest offenders. Round Worms can be found in a stool sample, where as Heart Worms have to be tested via blood work. If your baby is not on a Monthly Heart Worm treatment, it would be very wise to have him checked for Heart Worms. http://www.thepetcenter.com/gen/hw.html
There is also the possibility of a Heart Problem that can cause a dog to cough, gag, and wheeze. Since your boy is a little older we cannot rule this out. If this is possibility it would be best to get your boy into the Vet ASAP.
He may also have the beginnings of URI. This can happen with the crazy weather we have been having this year.
Allergies can also cause a cough.Plain Benadryl, at 1-2mgs per pound of body weight every 12 hours can help with aid with an allergic reaction.
Here is a site that talks about coughing in dogs.
This link is for Robitussin DM.
My recomendation is to have your boy checked out asap. Try the shower and steam to see if it offers any relief for tonight. I wish I could give you a more definative answer, but it is very hard without a hands on examinataion. Joan
*I will be off for the evening at about 3:10 Am est, as the site will be down for about 15 mins. I hope this will be of help. Please let me know if I can be of further help.