Prevent heartburn by avoiding spicy, greasy foods, caffeine, and carbonated beverages. Eat smaller, more frequent meals and avoid lying down immediately after eating. Over-the-counter antacids can help, but consult your healthcare provider for other options if needed.