It sounds like your dog might have either kennel cough
or canine influenza
Here are a couple of videos with dogs coughing with kennel cough to see if that is what you are hearing
You can see if some Robitussin DM will help the dog breathe better and control any cough or sneezing or runny nose. Read here about cautions and dose info
If you see a colored discharge from nose or eyes, if your dog coughs stuff up, seems lethargic, has any real trouble with breathing, or goes off eating, see your vet as your pet may have a secondary bacterial infection that will need antibiotics or other meds.
If what he is doing doesn't match kennel cough then it may be he has a trachea issue, something stuck in his throat etc and then seeing a vet is a good choice.
This site may help you locate an emergency vet if you need one
Hope this helps you!
Kennel cough is just the name of the virus - its a bit like we could call our colds "school cough" as so many school children catch it.
Dogs in kennels pass this virus around pretty easily so its called kennel cough but much like our colds the dogs can pick it up from any doggy friend who has it or even a dog that coughs or sneezes near him while you are out with him.Its not the kennel that causes the cough and its the way its easy to pass around in a kennel environment that gives it the name.
Distemper is a viral infection but most 2 year old dogs are well protected and would not get that if they have had their shots. I didn't consider it as its unlikely any well cared for 2 year old dog (which it sounds like your dog is) would get it.
Usually with distemper you see discharge from nose and eyes and maybe some coughing. You can read about it here
But unless your dog never has had any shots its not a likely problem.
That dry heave sound is very typical of kennel cough.
Kennel cough may clear up by itself. Do read the above website on the topic as well as on canine influenza. If you see any of the warning signs listed on those sites or in my first reply to you then you would want to get vet care.
I'll compare this to a cold again while most people get over a cold some get bronchitis or pneumonia and need a doctor's care and prescription meds, so too with the dogs with kennel cough or canine influenza (antoher virus that can cause this sort of coughing) some get over it no problem in 7-10 days and some get really ill and need vet care. Best choice if your dog seems really ill or extra quiet or has a colored discharge from eyes or nose or goes off eating is to see your vet for a full check up and any needed meds.
I hope Willie feels better soon!
Thanks for the accept!