I've noticed a number of people are posting on medical advice websites with the following symptoms: Sleep for 2-5 hours and wake up with a lot of back pain which goes away after getting up. Even napping during the day lying down will cause back pain in a couple of hours especially after a meal.
If this is happening to you, you may be suffering from acid-reflux erosion of the esophagus which can cause enervation (activation) of the nerves in the esophagus and stomach. This leads to your back pain via a process called Referred Pain. Referred pain is the process where pain induced in one part of your body is 'felt' in another part. As you can see from the chart in the Wikipedia article, stomach-based referred pain shows up in the middle of the back along the spine.
Now these pain symptoms are not going to be an exact match to the chart. Personally, I would feel like an electric charge was running along one of my ribs from my spine to my front during the earlier stages of my symptoms. Everybody's anatomy is slightly different and you'll get variations on the theme. However, it was primarily back pain that I was feeling. Now my pain almost exactly matches the chart.
After way too many specialists including a neurologist who should have had a clue about this, my GP at the time, Dr Karkalis in King of Prussia (fantastic doctor IMHO) who likes to review challenging patient charts at night for fun, thought my symptoms might be due to acid reflux. He was right, but in order to finalize the diagnosis, he prescribed a proton-pump inhibitor. After a few weeks my back pain from sleep was reduced significantly.
Another way to diagnose this and manage it longer term is to tilt the head of your bed up by 15-20 degrees to let gravity keep the acid in your stomach instead allowing it into your esophagus. If your back pain abates (not necessarily overnight though it often does) fairly quickly, then your back pain is likely due to acid reflux.
Sadly, you will need to sleep elevated for the rest of your life if you have acid-reflux back pain. The proton-pump inhibitors are pretty safe drugs, but they are not always be able to control your acid-reflux enough to control the pain completely. As you can see from my hammock blog post, hammocks work really well to set the right angle for sleeping and are much less expensive than adjustable beds.
Your acid reflux will be more or less severe at different times due to exercise, stress, eating habits, body weight so your management of it will need to accommodate the severity of your acid reflux. In other words, you may need to increase the angle of your bed when your acid reflux is more severe.
Also, check with your doctor and get tested for Barret's Esophagus. Basically, serious acid reflux sufferers are at higher risk for esophageal cancer.