Could it be acid reflux? Especially since it's worse when you're laying down. I know sometimes it can feel like you're having a heart attack, it's really painful.
Edit: I rtft
You know, I have chest pains as well, feels like a heart attack. 3 possible causes: bruised cartilidge at the sternum, muscle spasms in the back (which make you feel like your'e having a heart attack) and anemia
now that I look, every single one of those makes sense. I have always had back spasms and just general "imma fatty" back problems but normally the problem comes when I sleep on my chest/side. It has come when I was sleeping on my back too though so its hard to say that. The bruised cartilage could have been caused by getting kicked in the chest multiple times.