Here are a few tricks to make sure you sleep to relieve back pain. Two things to consider to relieve back pain while you sleep: position, and mattress.
For side sleepers, placing a pillow between your legs will help to even out your hips and take the twist out of your spine - full-length body pillows are great for helping with this. If you tend to sleep on your back, consider placing a rolled-up towel under your lower back for support, as well as a bolster under your knees to take pressure off your lower back and relieve back pain. If you must sleep on your stomach, try placing a pillow under your hips and reconsider using a face pillow - this will keep your body in a more natural position and prevent neck pain.
Doctors recommend a firm mattress for folks with back pain. If a new mattress isn’t in your budget, or you just want to try before you buy - place a piece of plywood under your current mattress for a couple of nights and see if that improves anything for you. Memory foam mattress toppers are also another great budget-friendly option.