Cough on lying down is due to acid reflux like in gastroesophageal reflux disease(GERD).
Acid from your stomach may back up into your throat. This is called acid reflux. It can cause heartburn or cough. Try raising the head of your bed about four inches with blocks. It also might help to avoid eating or drinking for two hours before you lie down. To help control the stomach acid, one should not drink alcohol or drinks with caffeine in them, or eat chocolate or spicy or greasy foods.
Take some OTC antacid like Mylanta.You can also take zantac(ranitidine)or prilosec(omeprazole).These will help.Also keep your fluid electrolyte balance optimum by drinking lots of fluids.
Sometimes the cause of chronic cough can be asthma and medications like antihypertensives (ACE inhibitors).Pls check them out.
I hope I have provided you with sufficient information. In case you need any more then pls post us.
Take care and regards.