strongcoffee I have had both knees replaced at different times, and trying to sleep wasn't easy.
There is no set way to sleep, and thankfully, you do not have to sleep on your back for six weeks like a hip replacement. For me, lying on one side with a pillow between my legs and one behind me was the most comfortable. It is up to you which side to choose.
A no-no is lying on your back with a pillow lengthwise behind one or both legs because that can cause a deep vein thrombosis.
It is very early days, so please take the pain relief, rest and elevate.