Philip Gehrman, an associate professor of psychology in the Department of Psychiatry at the Perelman School of Medicine and member of the Penn Sleep Center, explains the link between hot temperatures and poor sleep quality.

What happens is there’s a regular daily rhythm, called the circadian rhythm, our core body temperature. Our core body temperature is lowest roughly two to three hours before our natural wake-up time in the morning, and then increases over the course of the day and peaks about two hours or so before we start to feel sleepy at night. What happens is that after our core body temperature peaks, and then starts to drop, that cooling of the core tends to make us feel sleepy.

This is why if you’ve ever sat in a hot tub or taken a hot bath, afterwards, people often feel sleepy when they get out. And people assume it’s because they’re very relaxed. That’s part of it, but a bigger factor seems to be, you sit in that hot water, it raises your core temperature, then you get out and your core temperature rapidly drops, and it’s the cooling of the core that tends to make us feel sleepy.