I usually sleep on my side whenever possible, and found that bending the “new” knee to the extent possible, and putting a small, firm pillow between the knees gave me the most pain relief, especially when the TKR knee was on top. You can give that a try. Most doctors and PT people very much discourage using a pillow sideways under the knee when laying on you back since it delays the progress of getting it to become straight. I had some success with putting several sofa pillows under the knee and calf while resting the heel on the armrest of the couch…. but only for a limited time. This will still keep the knee fairly straight while taking a lot of pressure off, and keeping it elevated. It’s also easy to ice it at the same time, if this is recommended by your doctor.