Getting a good night’s sleep comes down to a handful of habits that align your body, your environment, and your schedule. Most adults need at least 7 hours per night, and adults over 65 do well with 7 to 8 hours. Teens need 8 to 10, and school-age kids need 9 to 12. But hitting those numbers only matters if the sleep itself is restful, and that depends on what you do in the hours before bed and the conditions you sleep in.
Keep Your Bedroom Cool and Dark
Your body temperature naturally drops as you fall asleep, and a cool room helps that process along. The ideal bedroom temperature for adults is between 60 and 67°F (about 15 to 19°C). For babies and toddlers, aim slightly warmer: 65 to 70°F. If you tend to run hot, lighter bedding or a fan can make a noticeable difference without cranking down the thermostat.
Darkness matters just as much. Your brain produces melatonin, the hormone that signals sleep, in response to dimming light. Even modest amounts of light at night can interfere with that signal. Blackout curtains or a sleep mask are simple fixes, especially if streetlights or early sunrises are a problem. If you use a nightlight, choose one with a warm amber or red tone rather than white or blue.
Manage Light Exposure Before Bed
The light from screens, LED bulbs, and fluorescent fixtures is particularly disruptive because it’s concentrated in the blue wavelength range (roughly 446 to 477 nanometers) that suppresses melatonin most effectively. Research published in the Journal of Applied Physiology found that narrow-bandwidth blue LED light suppresses melatonin even more powerfully than standard white fluorescent lighting. This isn’t a subtle effect. It’s a dose-dependent response, meaning more blue light equals more suppression.
The practical fix: dim your screens and overhead lights in the 1 to 2 hours before bed. Most phones have a “night shift” or “blue light filter” mode that shifts the display toward warmer tones. Better yet, switch to a lamp with a warm bulb and put the phone down entirely. Bright light in the morning, on the other hand, actually helps. Getting sunlight early in the day anchors your internal clock and makes it easier to feel sleepy at the right time later.
Time Your Exercise Right
Regular exercise is one of the most reliable ways to improve sleep quality. It reduces the time it takes to fall asleep, increases the amount of deep sleep you get, and lowers anxiety. But timing matters if your workouts are intense. High-intensity exercise within about 3 hours of bedtime can elevate your core body temperature, increase stress hormones, and keep your nervous system revved up when it should be winding down.
Moderate activity like walking, stretching, or yoga in the evening is generally fine and can even be relaxing. If you prefer intense training, try to finish at least 3 hours before you plan to sleep. Morning or afternoon workouts tend to have the strongest positive effect on nighttime sleep.
Watch What You Eat and Drink
Caffeine has a half-life of about 5 to 6 hours, meaning half the caffeine from your 3 p.m. coffee is still circulating at 9 p.m. If you’re sensitive to it, set a personal cutoff time in the early afternoon.
Alcohol is trickier because it feels like it helps. A drink or two can make you drowsy and fall asleep faster, but once your body starts metabolizing the alcohol, your sleep fragments. Your brain briefly wakes up over and over throughout the night, pulling you back into light sleep stages and cutting into REM sleep, the phase most important for memory, emotional processing, and feeling restored. You may sleep for 8 hours and still wake up groggy. If you do drink, finishing at least 3 to 4 hours before bed gives your body more time to clear the alcohol.
Heavy or spicy meals close to bedtime can also cause discomfort and acid reflux. A light snack is fine if you’re hungry, but avoid large meals within 2 to 3 hours of sleep.
Build a Consistent Sleep Schedule
Your internal clock, your circadian rhythm, thrives on consistency. Going to bed and waking up at roughly the same time every day (including weekends) is one of the most effective things you can do for sleep quality. When your schedule is erratic, your brain doesn’t get a reliable signal for when to start producing melatonin, and falling asleep becomes harder.
If your current schedule is far off from where you want it, shift gradually. Move your bedtime earlier by 15 to 20 minutes every few days rather than trying to jump from midnight to 10 p.m. in one night. A wind-down routine helps too. Spending 20 to 30 minutes doing something calm and screenless (reading, light stretching, a warm shower) teaches your brain that sleep is coming.
Use Background Noise Strategically
If you live in a noisy environment or find silence unsettling, background sound can help mask disruptions. The three most popular options each have a different character. White noise contains all audible frequencies at equal intensity, producing a steady hiss similar to a fan or TV static. Pink noise emphasizes lower frequencies more, creating a deeper, more balanced sound, like steady rainfall. Brown noise goes even further into the bass range, resembling a low rumble or heavy wind.
There’s no single “best” option. Most people find pink or brown noise more pleasant for sleep because they’re less hissy than white noise, but it comes down to personal preference. The key rule: keep the volume just loud enough to hear but not so loud it could wake you up. A sound machine or a phone app on a low setting works well. Avoid using earbuds at high volume all night, which can damage hearing over time.
Nap Without Ruining Your Night
Naps can be genuinely restorative if you time them correctly. The sweet spot is either under 20 minutes or around 90 minutes. A short nap keeps you in light sleep stages, so you wake up alert with minimal grogginess. A 90-minute nap lets you complete a full sleep cycle, including some deep and REM sleep, and brings you back to a light stage before waking. Anything in between (30 to 60 minutes) tends to pull you into deep sleep and cut you off mid-cycle, leaving you groggy for 15 to 30 minutes after waking.
If you work a normal daytime schedule, keep naps under 20 minutes and aim for early to mid-afternoon. Napping after 3 p.m. or for too long can reduce your sleep drive at night and make it harder to fall asleep on schedule.
Consider Magnesium if You’re Deficient
Magnesium plays a role in nervous system relaxation, and many people don’t get enough from diet alone. A small randomized, placebo-controlled trial found that adults with poor sleep quality who took 1 gram of magnesium daily for two weeks showed improvements in both sleep quality and mood compared to the placebo group. The most commonly recommended forms for sleep are magnesium glycinate and magnesium threonate, which are absorbed well and less likely to cause digestive issues than cheaper forms like magnesium oxide.
Magnesium isn’t a sleeping pill. It works best as part of the broader picture: a cool, dark room, consistent timing, limited screen light, and sensible habits around caffeine and alcohol. No single supplement compensates for a chaotic sleep routine, but filling a nutritional gap can remove one barrier to restful sleep.

