Sleeping on my back??

Question: I pulled a muscle in my back from coughing and can't sleep on my left or right side. I got an hour of sleep on the sofa list night but REALLY want to sleep tonight in bed. Is it safe for the baby if I sleep on my back if that's the only position that doesn't hurt? 40 weeks today. Thanks!