Sleeping on your side can make can ease chronic heartburn. The difference to getting a good nights sleep is choosing the correct side.
A study in The Journal of Clinical Gastroenterology induced heartburn in subjects by feeding them high-fat meals. Immediately after the meal, they had them sleep on one side or the other for 4 hours and measured the acid in the esophagus.
They found that sleeping on the right side aggravates heartburn. They also found the acid clearance of the esophagus took longer if sleeping on the right side.
No one knows for sure why. But other studies have had similar results.