I had the same with my son from him being a 7 or 8 months old, he was ok during the day but within an hour or so of him falling asleep he was coughing so bad that he was gagging, it scared me to death!! This would happen for months at a time with no signs of stopping. I finally got an app't with a paediatrician but just so I could prove it wasn't 'just a bad cough' I filmed him on camcorder & took it with me ( a bit extreme but I got the feeling I was being seen as over reacting), they immediately gave him an inhalor which did the trick instantly! He still has the odd episode now even though he's 4 & the inhaler is the only thing that sorts him out! Good luck & it does get easier xxx