Lots of people think that mattresses are more important than pillows when it comes to getting a good night’s sleep. But that’s a mistake. If you have occasional or frequent body aches, pillows are just as important as mattresses — or even more so.

Neck Pain

If you randomly X-rayed 100 people over age 55, 70% to 80% would have arthritis of the neck.

If you have neck pain, don’t sleep on your stomach. This position twists the neck. Instead, sleep on your side while hugging a second pillow. This offers the comforting sensation of something against your stomach but is far better for your neck.

My advice: If you have arthritis of the neck or neck pain due to another condition (such as muscle strain or injury) and find that it’s comfortable to sleep on your side, choose a pillow that is just thick enough to fill the space between your downside ear and neck and the mattress.

To determine the proper pillow thickness for you: When lying on your side with your head on the pillow, your head should be parallel to the mattress. Ask someone to see whether your nose is aligned with the middle of your chest. If your nose is higher than your chest, you need a thinner pillow… if it’s lower, you need a thicker pillow.

Before buying a pillow: At the store, compress the pillow with your head by lying down on it or lean your head on the pillow up against the store wall. Smart idea: Call around before shopping to find stores that allow for pillow returns.

If you have neck pain and typically sleep on your back, choose a pillow that just fills the gap between your neck and the mattress. A pillow that is too thick will push your neck forward, placing stress on the muscles in the back of the neck.

Good choices: A fluffable down pillow, such as the Superior Goose-Down Pillow (soft) by Eddie Bauer ($90 to $110, standard to king size), available at EddieBauer.com.

Or try an easily shapable buckwheat pillow, such as those from BuckwheatCo., which can also be heated in the microwave before bed ($57.99 for queen size), BuckwheatTherapy.com. A heated buckwheat pillow smells like freshly baked bread.

Low Back Pain

For years, low back pain sufferers were advised to sleep on their backs on very firm mattresses or even on the floor. We now know that these people should choose whatever sleeping position feels best — except on the stomach, which can increase the forward curve of the lower back and jam the spinal joints.

My advice: If you have back pain and like to sleep on your back, slip a pillow under your knees. This flattens your lower back against the mattress, discouraging the muscle spasms that can occur if the low back is arched. The pillow can be made of any material as long as it’s about three to four inches thick.

Good choice: The Duro-Med Elevating Leg Rest ($12.61), available at Amazon.com.

If you’re a side sleeper, you may straighten your bottom leg and bend your upper leg in front of you to avoid the discomfort of your knees rubbing together. But this position twists your body from the waist, placing strain on your lower back.

My advice: Place a pillow or a rolled-up towel between your knees to keep your top leg parallel with the bed.

Good choice: The Back Buddy Knee Pillow ($39.99), available at Amazon.com.

If you tend to switch back and forth in your sleep between your side and back, try a dual pillow, such as Therapeutica’s Sleeping Pillow ($88.95 to $109.95, average to large size) TherapeuticaInc.com. It is designed to offer correct support and stability whether you’re sleeping on your back or side.

Rounded Shoulders

Most people’s shoulders are rounded to some degree — due, for example, to spinal arthritis or prolonged computer usage. If you typically sleep on your side, your top shoulder may sag forward, exacerbating poor posture.

My advice: Try a boomerang-shaped pillow that supports your head and neck while curving down the front of your torso to provide shoulder support.

Good choice: The Dr. Mary Side Sleeper Pillow ($232), available at The Pillow Bar, ThePillowBar.com.