Too much nighttime scrolling, caffeine overload, and worries about the state of the world might be keeping Americans up at night. In fact, 30 percent of U.S. adults are getting less than the seven hours a night of shut-eye recommended by the American Academy of Sleep Medicine for optimal health, according to the National Interview Survey data brief recently released by the Centers for Disease Control (CDC).

“People get really good at not sleeping well,” said Abhinav Singh, a sleep medicine expert and the author of Sleep to Heal: 7 Simple Steps to Better Sleep. “You lay down, you can’t doze off, and then you look at the clock and the behavior repeats itself.”

You can get better sleep. It might help to understand that, while there are many reasons you often can’t doze off quickly or wake up in the middle of the night, they fall into just three categories: external, internal, and mental.

“External are unfavorable elements in your environment, from outside lights, a bad mattress, or someone next to you snoring. If things aren’t ideal, you might not sleep,” Singh said.

External factors can also be bad habits you inflict on yourself, such as drinking caffeine shortly before bedtime or scrolling through all the crummy news on your phone before you tuck in—or after you wake up at 3 a.m.

Internal factors include ailments like arthritis pain, sleep apnea, fluctuating hormones, and restless leg syndrome—basically anything happening to you that makes slumber more difficult.

But the most challenging foe of slipping into deep, sweet dreamland might be your own mind. “If you’re a good sleeper, you don’t have to do anything; you just lie down and doze off,” said Jamie Zeitzer, a professor of psychiatry and behavioral sciences at Stanford University.

If you develop insomnia, you might be in for a lifelong struggle against the little voice in your noggin saying, “I can’t get to sleep, I can’t get to sleep.”

Here are 25 tips to help you drift off and stay asleep.

Become a Smarter Consumer Get free, expert advice delivered to your inbox every Wednesday when you sign up for the Weekly Checklist newsletter.

Block Out the Light

1.  Don’t be afraid of the dark. Sleep is a function of your circadian system—the 24-hour cycle your body goes through that tells you when to go to sleep or to get up. Because it’s tied to sunrise and sunset, it’s crucial that you turn down the lights to horror-movie level in your boudoir. “The darker, the better,” says Singh. “Studies show that even tiny bits of light can interfere with sleep.” That means you should…

2.  Put up blackout shades or curtains. Hotels have the right idea with those walls of drapes you can use to shut out the Vegas morning sun or the streetlights outside your motel. Click here for our latest advice, ratings, and price comparisons of window treatment stores.

3.  Address other sources of light pollution. Get rid of always-on digital clocks and adjust smart thermostat settings so the display goes dark. Use electrical tape to seal off small beams of light from internet routers and other devices. If your kids need a hall light kept on, install a door sweep to block it from bleeding into your room.

Get Comfortable

4.  Make sure your mattress is comfortable. Whether that means you prefer firm or soft, foam or springs, what’s important is that your mattress cradles you in whatever your idea of comfort is. If you and your partner disagree on firmness or type, buy separate ones or an adjustable model.

Consumer Reports regularly performs rigorous testing of mattresses, judging them for comfort and value. Here at Checkbook.org, you’ll find ratings of mattress stores and our guide to shopping for them. Know that many retailers make comparing mattresses difficult, using private labeling, fake sales, and shifty fees to confuse customers and prevent meaningful price comparisons. Mail-order mattress companies are also popular now. But it’s still best to visit local stores to flop down on several models at wide price points before you buy.

5.  Pick your perfect pillow. CR rates pillows, too. And most stores or websites that sell them offer buying guides to help you choose the right place to rest your head by whether you’re a side, back or faceplant sleeper.

6.  Keep your boudoir cool. Toward bedtime, your body temperature drops to bring on sleep; if you keep your bedroom chilly, that helps, too.

Nix the Noise

7.  Use earplugs to block out noise from snoring spouses (and pets), car alarms, zombie hordes, or whatever is making a racket and keeping you up. The silicone variety that covers but doesn’t stuff your ear canals are quite comfortable.

8.  White-noise machines and smartphone apps create a wall of sound (surf, crickets, birds, wind). Even running a simple fan might help.

9.  There’s much you can do in and around your home to lower unwanted noise by installing sound blocking and absorption materials, from inexpensive door sweeps and acoustic panels to pricey projects like replacing doors and windows. Peep our tips on soundproofing your pad.

10.  Shut off phone alerts. It’s obvious, but we’ve all been jolted awake by pinging or buzzing. Do Not Disturb mode is your friend.

Stop Snoring

11.  If you or your partner snore, consider asking your primary care doctor about getting a sleep study to determine whether the cause can be easily cured.

Simple studies can be done using a take-home device that will record various data. In some cases, you’ll still have to bunk at a sleep center overnight. Tests may find that you have a deviated septum, sleep apnea, or other condition that impacts your breathing and sleep, as well as others’ sleep. Then you can address that issue.

12.  If you have sleep apnea, you might need a CPAP [continuous positive airway pressure] machine to help you breathe at night. While some research suggests these devices are overprescribed in the U.S., many users report improved sleep—and marriages.

13.  Another contraption that might stop snoring? A mouthguard. Some dentists will prescribe them, but, increasingly, once your primary care doctor indicates you need one, you can order it online yourself.

14.  Make lifestyle changes. The National Sleep Foundation, a nonprofit sleep education and advocacy group, counsels skipping drinking alcohol shortly before bed and losing weight to see if either reduces your snoring. Studies also show that the GLP-1 drug Zepbound (tirzepatide) may help with both shedding pounds and combatting sleep apnea.

Adopt Healthy Habits

15.  Cut down on caffeine. The amount individuals can have (and when) and still get good rest varies. But if you’re having trouble dozing off or staying asleep, “put the brakes on,” Singh said. “The U.S. is so obsessed with caffeine; I think sometimes people don’t really know how much they are ingesting.”

16.  Don’t eat too close to bedtime. Your body will spend energy digesting chow instead of getting sleepy.

17.  Booze, particularly in excess or just before night-night, hampers rest. You might initially pass out in an F. Scott Fitzgerald-like stupor only to wake at 3 a.m. with a dry mouth and headache. Skip the stuff altogether or stop drinking two to three hours before you want to get shuteye.

18.  Work out! Numerous studies support the hypothesis that exercise during the day can help you fall asleep faster as well as keep you from waking up in the middle of the night. Moderate aerobic activity increases the amount of slow wave or deep sleep that you get.

19.  Try to limit screen time within an hour or two of bed. The blue light from computers, smartphones, TVs, and their ilk might interfere with rest since it can impact the sleep-inducing hormone melatonin.

Don’t Take Too Many Chill Pills

20.  There are numerous pills and potions that promise to help you sleep better. Some are potentially addictive and only safe to use short term; others can become part of your nightly routine. Still, Singh said, “these things are really only training wheels—you need to learn to sleep better on your own.”

21.  Melatonin, which your body produces naturally to signal it’s time to sleep, can help you doze off. It’s available over the counter, but you should still consult a doctor before taking it, especially regularly. A preliminary study of people with insomnia found those who took melatonin for a year or more were diagnosed with heart failure at a higher rate—although more research is needed to determine whether melatonin was a cause.

22. Sleeping pills and liquids provide more of a knockout effect. Pop an Rx-only one (Ambien, Edluar), and it’ll help you sleep by sedation or a hypnotic effect. Over-the-counter liquids and pills (ZzzQuil, Unisom, etc.) use sedating antihistamines, either diphenhydramine or doxylamine succinate, to make you sleepy.

All sleeping pills carry risks of grogginess and impairment, heightened if you take them with alcohol. Ambien and other prescription sleeping pills can also be addictive if used for an extended period.

23.  If you’ve got chronic insomnia, ask your doctor about a newer class of insomnia drugs: dual orexin receptor antagonists (DORAs). Sold under the brand names Belsomra, Dayvigo, and Quviviq, these medications block receptors in your brain that help you stay awake, especially at night. Because DORAs don’t force you into unconsciousness and carry a lower risk of dependence than sedatives, scientists think that the sleep they induce is closer to normal.

Establish a Routine and Stay Positive

24.  Some pros call setting a sleep schedule and routine “sleep hygiene.” Try to go to bed and wake up at similar times each day and identify, via trial and error, what helps you zonk out easily and what makes you stay up counting sheep.

25.  Try a relaxation app like Calm, Hatch, Headspace, Sleep Cycle, and Sleep Easy. These can play soothing music, sounds, stories, or guided breathing and meditation exercises. Some apps are free; some cost $5 to $15 per month.