Wear a sling.
Protect an aching shoulder by immobilizing it with a sling. Putting a pillow under your armpit can help too.
Try sleeping on your unaffected side with your knees drawn up. Place a small pillow between your knees to take pressure off your hips. If you lie on your back, put a thin pillow under your shoulders.
Buy a new mattress.
A firm mattress is usually preferable. You need something that will cushion your body and support your contours.
Check your bedroom.
Sleep hygiene is especially important if you have joint issues. Darken your bedroom and block out distracting noises. Keep electronic devices out of your bedroom or turn them off at least 2 hours before retiring.
Maintain a consistent schedule.
As much as possible, go to bed and rise at the same time each day. Resist the urge to sleep in, even on weekends and holidays.
Get out of bed.
If you can't sleep, it may be better to get up and do something boring until you're sleepy again. As a bonus, moving around can reduce joint pain because it decreases swelling and increases lubrication.