Stay Updated on Developing Stories

How you sleep can cause neck and back pain

Editor's Note: (Sign up for CNN's Sleep, But Better newsletter series. Our seven-part guide has helpful hints to achieve better sleep.)

(CNN) Neck pain may have many causes: Stress, poor posture, texting, injuries from sports, car or other accidents and chronic illnesses such as fibromyalgia, to name a few. But there's another culprit you may not be considering — how you sleep.

"Generally, when you wake up with neck pain, either your pillow isn't right for you or the position in which you sleep is aggravating your neck, or both," said sleep specialist Dr. Raj Dasgupta, an associate professor of clinical medicine at the University of Southern California's Keck School of Medicine.

Experts suggest choosing a pillow that supports the natural curve of your neck, which could be quite different to the pillow used by your sleeping partner.

"Sleeping is an individual experience," said Colleen Louw, a certified spinal and therapeutic pain therapist and spokesperson for the American Physical Therapy Association, in an email.

"Working with a physical therapist can help you understand what is resulting in exacerbations of pain and what positions or strategies might result in more restful sleep," Louw said.

Sleep positions affect pillow choice

In general, sleeping on your back or side is best for preventing neck or back pain, experts say, as both positions help maintain your spine's natural curves.

Back is best: The ideal position is to sleep on your back on a pillow that allows your neck to be positioned so you're looking straight at the ceiling, Dasgupta said.

"If the pillow is too fluffy or too big, then you're going to flex your head forward, and it's going to cause some issues," he said. "Stand up against a wall and put the pillow behind your head. Are you still looking straight? You don't want to be looking at the ceiling or looking down, you want to be perpendicular to the wall. That pillow will hopefully translate to no neck pain."

Back sleepers should also try to sleep with hands by their sides. A 2017 study found sleeping with one hand up by the head significantly increased a person's neck and shoulder pain.

"If you sleep on your back, try using a firm pillow or bolster under your knees," Louw added. "This can help keep blood flow moving to avoid back pain if your knees are slightly flexed while you sleep."

Side sleepers: Sleeping on your side is OK as long as you keep your head and neck aligned with the rest of your body. To do that, you'll need the right pillow.

Don't sleep on your stomach if you want to avoid neck pain, experts say.

One 2010 study on side sleepers found people who slept on feather pillows woke much more often than those who slept on latex pillows, thus ruining the quality of their sleep. Dasgupta suggests side sleepers choose a firm pillow that will stabilize the neck during sleep.

"If you're a side sleeper, you might think that a hard pillow can hurt your neck, but it's usually a pillow that's too soft that makes you wake up with neck pain," Dasgupta said. "There's going to be a gap between your head and the mattress, so your pillow should serve as a filler."

Sleeping with additional pillows can also help keep head, shoulders, hips and knees on the same plane, Louw said.

"(Use) pillows between your knees, and sometimes in front of your chest or belly to rest your arm," she suggested, "(to) prevent your shoulders from rolling forward which could rotate your neck while you are sleeping. The idea is to keep blood flowing through your joints and subsequently your nerves to prevent pain."

No belly flops: "The one position that we don't encourage is sleeping on your stomach," Dasgupta said.

Sleeping on your stomach forces your neck to tilt on one side for an extended period of time and forces your lower back to arch inward due to gravity, leading to neck and back pain.

People who sleep on their stomachs should do their best to transition to sleeping on their sides or back, experts suggest. Try a cervical pillow that is especially designed to keep your neck in place. Tuck firm pillows, rolled up bath towels or blankets, or a long body pillow on either side of your body to keep you from rolling onto your stomach during sleep.

What to do about neck pain

What's the best course of action if you wake up with neck pain?

Heat and ice: Try taking a very warm shower to loosen and relax your neck muscles, which can reduce your pain and improve your range of motion, Dasgupta said. You can also try ice packs, and even alternate between a heating pad and ice.

"The main thing is not to use either one for more than 15 minutes at a time," Louw said. "But they could be used hourly if needed."

Massage: Manipulating muscles and tendons in the neck can increase blood circulation and reduces muscle tension, Dasgupta said. Try different massage techniques until you find the one that works for you.

Move and stretch: While you should avoid strenuous activities and limit movements that worsen pain, "walking and moving around are still encouraged, because full bed rest may cause the stiff neck and back pain to last longer," Dasgupta said.

Should you stretch? If you do, keep the movement very gentle so you don't make matters worse. But there are more effective treatments, Louw said.

"Gradual and paced active movement can be more beneficial to decrease stiffness and pain than stretching if instructed by a healthcare professional or physical therapist," she said.

Studies show exercise can improve neck pain from sleep much better than other noninvasive interventions such as massage, acupuncture, yoga or relaxation techniques. A 2020 study found mood and sleep improved when people with chronic neck pain increased their exercise levels.

"If the pain and stiffness are bad enough to significantly limit movement, consider taking acetaminophen or ibuprofen at the recommended dosing. Ask your healthcare providers if you should avoid any of these medications," Dasgupta said.