When you're sleeping at night and laying down in bed the mucus can pool in the back of the throat and cause coughing which can be worse at night due to the laying down position.
If your coughing gets worse during the night you should try elevating your head more to help keep the mucus from pooling at the back of your throat and prevent coughing.
Elevating my head up about 3 to 4 inches at night helps stop my coughing and helps me sleep better.
I would also recommend using a humidifier in your room or add some Vicks to your chest to help you breathe much better and help with the coughing.
Elevating your head when sleeping can help to decrease postnasal drip and symptoms of GERD, which both cause coughing at night.