your baby either has a cold (viral infection) or is teething. or both. babies often have a difficult time dealing with drainage either saliva or mucous when they are lying flat so a cough is important to clear their airway. coughing can certainly be a sign of something more serious (bronchiolitis rsv pneumonia etc. ) because your baby is immunocompromised due to age so it would be best to have a medical provider listen to those little lungs. there is very little you can do at this age to control a cough but you can make it easier for them to swallow excess mucous by using a cool mist humidifier in the room and sucking out nasal mucous using a special bulb syringe. a drop of saline in each nostril just prior to aspirating it will help loosen any thick mucous.
my 9 month old baby is coughing really hard while sleeping