The most likely reason is that you might have a sinus infection.
This can arise as a complication of the viral infections we know as the common cold or flu, which may also account for your cough.
With sinus infections, the openings to the bony cavities we call sinuses become blocked, usually partially, but sometimes, completely. When you cough, pressure within the sinuses build up leading to pain. The blockage can be dependent on posture which may be the reason that pain is not as bad when you are lying down.
Of course, there can be other reasons for your symptoms and if they are not improving, or linger, please seek further advice from your doctor.
Do you have questions? Please feel free to ask.
Take our quick quiz to discover just how healthy your immune system is, as well as some useful information about your general health and wellbeing!