Back pain is, no doubt, one of the more frustrating conditions you can have. Even mild pain affects how well you move. It is possible to find the cause of the pain and prevent more pain from showing up, but many times, it can be a touch-and-go situation where you are sort of blindly seeing what works. One set of potential causes has to do with your head and neck -- and if your pain turns out to be a result of one of these causes, you can take steps now to solve your problem once and for all.
If you have a lot of hair -- as in long, thick hair down past your waist, for example -- the weight of the hair could be placing strain on your neck, radiating down to your back. If you've noticed that your back pain is not as bad in the morning (after you've been lying down all night) or that your back pain seems to be connected to neck movements, you may want to consider cutting your hair.
Finding the right pillow takes some doing. It's worth the effort, though, because the wrong pillow can make you sleep in odd positions, with your head and neck bent at angles that leave you hurting when you wake up. These odd angles place strain on your back, leading to muscular pain. Note that while your upper back might be closest to your neck, it might not have the most pain. Because a strange neck angle often leads the rest of your torso to twist as well, you could have lower back pain from something happening to your neck. Start experimenting with pillows and don't be afraid to ignore the manufacturer's instructions about which pillow is better for X or Y sleep position. It doesn't matter if a firm pillow is meant for side sleepers -- if it doesn't help you, try another.
Text Neck and iSlouch
Text Neck and iSlouch sound like jokes, but they're real conditions caused by the constant downward slant of your head and neck while texting or looking at a tablet. While these tend to lead to neck pain, the pain can radiate into your back due to the stress the position places on your muscles and spine. Pain is most likely to be in your upper back, but don't discount your texting habits if you're having middle or lower back pain, either. Start working on your posture and move your electronic devices up to eye level so you can keep your head up and your neck straight.
See a specialist if you can't make your back pain go away by changing your hair, sleeping habits, or neck position. You shouldn't have to live with the pain.