Sleep issues

I’m 3 weeks post surgery and my sleep is horrible. I sleep on my back and just this fact alone is very hard. It’s really hard to stay in one position for any number of hours. The pain in my leg wakes me every couple hours. If I sleep for more than two hours at a time I feel lucky. When will this get better and any suggestions on what I can do?