When your body hurts, sleeping can be difficult, to say the least. A way to help take pressure off of your spine is by placing pillows under and between your knees, or under your hips when you're sleeping on your stomach. Sleeping on your stomach is thought to be the worst position for your back because it makes your spine bend and press down. Here are some pictures to illistrate what I'm talking about.
Placing a pillow in these ways help aline your spine in it's natural position, taking pressure off of the spine, and helping to ease pain. Just today, I went to lay down due to neck and back pain and put a blanket between my knees while I laid on my side. I don't like to sleep on my back much unless I absolutely have to b/c of pain. The blanket took pressure off of my spine and hips, making it easier for me to fall asleep.
There are pillows that are manufactured specifically for these purposes, but you can save yourself the money by using a regular pillow or a blanket.