I had simultaneous bilateral THR (full replacement) almost 3 yrs ago. I do think sleeping was one of the harder parts of my recovery. We did go out and buy a recliner which I found was the best investment for my surgery we made. We raised it up on 4 bed raisers and made sure that I could reach the control lever easily. I spent a lot of my days in that recliner, whenever I started to tire, and took many hours of napping in it. It was wonderful. This helped me to get the needed sleep so that I was not in bed for so many hours at a time. When a good friend had 1 hip replaced, he was telling me sleeping was the hardest for him too, but no one had told him to get a recliner, so we took our recliner right down to him and the very next day he called almost in tears he was so grateful for a good sleep. He ended up actually sleeping in the reclliner full time for a few weeks. On a good note, it is only a short time that you have to stay on your back. I know it seems forever at the time, but it will pass quickly.
As far as sleeping in bed, it was real rough at first since you just can't move around. After experimenting a bit, I found that lots of pillows was the only way I could stay comfortable for any period of time. I used one under my ankles, two inder my knees, and several behind my back. I would think a hospital bed could do the same. You just don't want to be flat on your back at all!
Good luck!
Andrea