F.W.
This could be from sleep apnea. I would bring him to an ENT for an evaluation. If he stops breathing during the night, he could be coughing and hacking as a result of trying to start breathing again. My son had his tonsils removed because of the same thing and the only time he coughs during the night now is when he is sick. Good luck.