Lots of very credible suggestions here- my immediate reaction was dehydration or possibly blocked sinuses (or a sinus infection) or your pillow and sleeping position.
Some swear by sleeping with the bedroom windows open, others, closed, but as long as the room is well aired during the day it should be a matter of choice.
Are these headaches the lingering “gnawing” sort or sharp and severe? Do they pass after your first TIB?
If you have tried all the things suggested and the headaches continue, especially if they get worse, it is always wise to seek medical advice, even if only to put your mind at rest.