People who sleep well say they get daytime exercise, unwind before bed and adopt a schedule. (Bigstock)

How do you get a good night’s rest? Consumer Reports posed that question to 8,900 people who reported having few sleep difficulties (or none at all) in the previous 30 days. Here’s what it found: Good sleepers are more likely than others to exercise during the day, go to bed and wake up at a set time, unwind for 30 minutes before going to sleep, and engage in sexual activity before bed.

To help you create a sleep environment that is conducive to good rest, here are some tips from sleep specialists, Consumer Reports’ readers and the experts in its labs.

Get the right mattress. If you’ve slept on the same mattress for more than eight years and wake up stiff and sore, you should think about getting a new one. Worn-out mattresses don’t supply the same comfort and support as newer ones. And as we grow older, our bodies become more sensitive to pressure points, so a cushiony mattress might provide a better night’s sleep than a rock-hard bed.

One in five U.S. adults shows signs of chronic sleep deprivation

Dim the lights. Watching TV before climbing under the covers might seem like a great way to relax, but it can cue your brain to feel alert rather than drowsy. If you use an e-reader in bed, consider features and apps that display white text on a black background, which is less stimulating than the usual brightly lighted white background. To dim the glare of street lights or early-morning sun, use blackout curtains or wear eyeshades.

Neutralize noises. White noise can improve sleep quality by reducing the time it takes to fall asleep and the number of times you’re awakened while sleeping. Of the readers in Consumer Reports’ 2012 survey who tried sound machines, 43 percent said that the devices helped them sleep better. The machines — which can make you feel as though you’re in a forest or at the beach — worked almost as well as insomnia drugs for putting respondents to sleep. To block out unwanted sounds, you can also try turning on a fan or using earplugs.

Adopt a routine. Keep a consistent schedule of wake-up time and bedtime, and don’t vary them by more than an hour each day. Adjust the temperature in your bedroom to between 68 and 70 degrees, which is the ideal range for sleeping. Avoid exercising, eating a big meal or drinking alcohol or caffeine within three to four hours of going to bed. Put your dog or cat in a separate sleeping spot, and snuggle up with your significant other instead. You’ll sleep better.

When to try sleeping pills

If lifestyle changes aren’t enough, you might try an over-the-counter sleep aid that contains the antihistamine diphenhydramine (Nytol, Simply Sleep, some Unisom products, and generics) or doxylamine (Unisom SleepTabs and generics). Those are generally better than combination products such as Advil PM and Tylenol PM. If an OTC remedy doesn’t help, talk with your doctor about zolpidem, the generic version of the drug Ambien. But avoid taking any sleeping pills for more than seven consecutive days. If problems persist, see your doctor to determine whether you have an underlying condition that’s causing your sleeplessness.

Copyright 2014. Consumers Union of United States Inc.

For further guidance, go to www.ConsumerReports.org/Health, where more detailed information, including CR’s ratings of prescription drugs, treatments, hospitals and healthy-living products, is available to subscribers.