27 weeks pregnant sleeping positions

Is it okay to sleep on your back? Is there a certain amount of weeks I should stop sleeping on my back