Serious back blues

Shenece
I'm only 2 days short of being 27 weeks and for the past two weeks now I have been having the absolute worst back and rib pain. The only thing that makes it feel not so bad is me laying or sleeping on my back but I know that isn't good for the baby. Idk what to do at this point, I toss and turn all night and just can't seem to find any comfort. Any suggestions on how to deal with this or make it better ?