It's the holy grail of nighttime pursuits. We just want a few solid hours of uninterrupted, restful sleep. Often, we toss and turn while our bedmate slumbers blissfully, making the situation even more painful.

There has to be some secret to falling and staying asleep, right?

Experts say there are plenty of things you can do to make it easier to get better sleep. Try these tips and maybe you won't be doomed to toss and turn all night.

Have a sleep schedule. It can be so tempting to sleep in on the weekends after a work week of rough sleep, but sleeping in just throws your circadian rhythm out of whack. Going to bed and waking up at the same time every day helps regulate your body clock. Try not to change your sleep schedule by more than an hour on weekends versus weekdays, suggests the Mayo Clinic.

Set a bedtime ritual. Just as little kids sleep better when they have a bath, a snack and a bedtime story, adults have a better night's sleep when they follow a regular bedtime routine. Try softening the transition from wake time to sleep time with some relaxing activities before bed. The Division of Sleep Medicine at Harvard Medical School suggests maybe taking a bath, reading a book, watching TV or doing some relaxation exercises. Avoid any stressful or stimulating activities that might make your body produce cortisol, the stress hormone that will make you more alert.

Create a great sleep environment. Make sure your room is cool, dark and quiet. It's usually harder to sleep when your room is too warm, noisy or bright. That may mean investing in some heavy curtains or blackout shades. You may also need a white-noise machine or an app for your phone if outside noises bother you. The National Sleep Foundation says the ideal temperature for sleep is between 60 and 67 degrees F (15 to 19 degrees C).

young woman using phone in bed The blue light given off by electronics can mess with melatonin. (Photo: tenenbaum/Shutterstock)

Turn off electronics. The glowing blue light from your phone, tablet or laptop can affect levels of the sleep-inducing hormone melatonin. Shut down screens an hour before bed. If you can't stand the idea of being phone-free that long, look for an app for your computer or a setting on your phone that allows you to choose warmer colors as it gets closer to bedtime.

Limit the bedroom to sleep and sex. Don't set up your home office here. Or a television. Or your kid's craft desk. The bedroom should have only two uses. Limiting what you do in your bedroom should help strengthen your mental association with sleep when you climb under the covers.

Don't nap. When you don't sleep well at night, it sure can be tempting to grab a little nap during the day. But you'll be sleepier if you forego a nap and wait until bedtime to go to bed, says WebMD. If you really need to rest, limit naps to 20 minutes. A better way to get out of a mid-afternoon slump is a cold glass of water or a brisk walk.

Cut the caffeine. You might need coffee or soda to keep you alert at work, but the effects of that caffeine can linger for hours, keeping you wired when you crawl into bed. It's also a good idea to watch nicotine and alcohol. The stimulating effects of nicotine can also take hours to wear off. And although alcohol can make you sleepy early on, it can wreck your sleep later in the night.

Evaluate your bedding. How old is your mattress? When was the last time you replaced your pillow? A good quality mattress may need to be replaced about every 10 years, says The National Sleep Foundation. You may also want to consider airtight, dust-proof covers to seal your mattress and pillow to keep allergens at bay to help avoid sneezing, stuffiness and sniffles.

Be smart about exercise. Exercise can help you fall asleep, but try not to do it too close to bedtime. Exercise also stimulates cortisol, which keeps you alert and makes it harder to sleep.

Watch what you eat and drink. Don't eat a big meal right before bedtime, but don't go to bed with your stomach growling. Being stuffed or starving will make you too uncomfortable to fall asleep easily.

dog and person in bed Having a dog in the bed can sometimes mess with your sleep. (Photo: ThiagoSantos/Shutterstock)

Reconsider your pet's sleeping habits. If you sleep with your dog or cat, sometimes their snoring or cover-stealing can mess with your slumber. Sleeping with your pet in the room can help you sleep better, but sleeping with your bed actually in the bed may not be such a great idea, according to a Mayo Clinic study. Maybe move your pet to his own bed or a crate so you can sleep more soundly or try these other tips to sleep better with your dog in the room.

Don't watch the clock. When you have insomnia, it's tempting to keep looking to see what time it is. But staring at the clock when you can't fall asleep can just make stress worse. Turn the clock (or your phone) away from you. If you find that you're tossing and turning for a long period of time, get out of bed and do something quiet and restful like reading or listening to music. Keep the lights dim and go back to bed when you start to feel tired.

Write it down. Often we can't sleep because our minds are too full of all the things we need to accomplish the next day. A small study found that people who took five minutes to write a to-do list before bed fell asleep more quickly than those who wrote down tasks they'd already completed.

Mary Jo DiLonardo writes about everything from health to parenting — and anything that helps explain why her dog does what he does.