Worried about sleeping on my back ?

I'm 27 weeks pregnant and I never sleep on my back. I always fall asleep on my side ,but only recently I've found myself waking up lying on my back and I'm worried every time that I'm harming my baby. How can I prevent this ?