Hi, L.. I don't know what to tell you about why the cough is lingering so long, but I can tell you a trick for getting the cough to subside at night. I've tried it with my 4 year old son, and it works. (My dad passed this along to his 83 year old sister, and she tried it, too, and said it worked for her as well.)
Since the nerves on our feet are connected to all kinds of places on our bodies, smear some Vicks Vaporub on your child's feet at bedtime, cover the feet with socks (so it doesn't get all over the sheets), and the cough should disappear.
Good luck, K.