It could be pneumonia! go to your MD and get checked out!!
It's hard to speculate. It could be musculoskeletal/postural or pulmonary or ??? I would be trying different sleeping positions, but if you are having sleep problems you may have sleep apnea and you are going to have pain until that is controlled.