Stomach pain that shows up when you lie down at night usually comes from acid or digestive irritation that gets worse in a horizontal position. When you’re upright during the day, gravity helps keep stomach contents where they belong. Once you’re flat, that advantage disappears, and acid can creep up toward your esophagus or pool against inflamed stomach tissue. The good news: most causes are manageable once you identify what’s happening.
Acid Reflux Is the Most Common Culprit
Gastroesophageal reflux disease (GERD) is by far the most frequent reason your stomach hurts when you lie down. A ring of muscle at the top of your stomach, called the lower esophageal sphincter, is supposed to act as a one-way valve. It lets food in but keeps acid from splashing back up. Sometimes this valve relaxes when it shouldn’t, allowing acid into your esophagus.
What’s interesting is that reflux episodes actually happen more often when you’re upright. But the ones that occur while you’re lying flat tend to feel worse and last longer, because gravity can’t pull the acid back down into your stomach. The result is a burning sensation in your upper abdomen or chest, a sour taste, or a dull ache that seems to radiate upward. Eating close to bedtime makes this significantly worse, since your stomach is still full of acid actively breaking down food.
It Might Be What (and When) You Ate
Certain foods relax that sphincter muscle and slow digestion at the same time, which is a recipe for nighttime pain. The biggest offenders are high-fat, salty, or spicy foods: fried food, pizza, fast food, bacon, cheese, and processed snacks. Tomato-based sauces, citrus fruits, chocolate, peppermint, and carbonated drinks also cause problems. These foods can sit in your stomach longer than usual, and if you go to bed before they’ve moved through, the acid they generate has nowhere to go but up.
The timing matters as much as the food itself. Going to bed less than three hours after dinner is significantly associated with increased reflux. Waiting at least three hours, and ideally four, gives your stomach time to empty most of its contents before you lie down. A short walk after dinner can also help move things along.
Ulcers and Stomach Inflammation
If the pain feels more like a gnawing or burning sensation in the center of your upper abdomen rather than a rising acid feeling, gastritis or a peptic ulcer could be the cause. Gastritis is inflammation of the stomach lining, and it produces a burning pain along with nausea, bloating, and gas. When you lie flat, stomach acid spreads more evenly across that inflamed tissue, which can intensify the discomfort.
Peptic ulcers, particularly duodenal ulcers (which form in the first part of the small intestine), follow a distinctive pattern. The pain typically hits two to three hours after eating, which for many people lines up with bedtime. Nocturnal pain is especially common with duodenal ulcers. Gastric ulcers, by contrast, tend to cause pain within 15 to 30 minutes of a meal. If you notice your stomach pain reliably shows up late at night and improves after eating something, an ulcer is worth investigating.
Gallbladder and Pancreas Pain
Less commonly, nighttime stomach pain that worsens when you lie flat can point to your gallbladder or pancreas. Gallstone attacks often flare after a heavy or fatty dinner, producing sharp pain in the upper right abdomen that can radiate to your back or shoulder. Pancreatitis, an inflammation of the pancreas, causes intense upper abdominal pain that characteristically gets worse when you lie flat on your back but improves when you lean forward or curl into a ball. If your pain follows this pattern, especially if it’s severe, it’s a different category of problem from reflux and needs medical evaluation.
How to Reduce Nighttime Stomach Pain
Elevate Your Upper Body
Stacking pillows under your head doesn’t work well because it bends your neck without changing the angle of your torso. A wedge pillow is more effective. Most wedge pillows designed for reflux sit at a 30- to 45-degree angle, elevating your head between 6 and 12 inches. This creates enough slope for gravity to keep stomach acid in place. You can also raise the head of your bed frame by placing blocks under the front legs.
Time Your Last Meal
Finish eating at least three hours before you plan to lie down. If you eat dinner at 7 PM and go to bed at 10 PM, that gives your stomach enough time to process most of the meal. If you need a late snack, keep it small and avoid the trigger foods listed above.
Sleep on Your Left Side
Your stomach curves to the left, so lying on your left side positions the junction between your stomach and esophagus above the level of stomach acid. Lying on your right side does the opposite, making reflux more likely.
Over-the-Counter Options
Antacids provide fast but short-lived relief by neutralizing existing acid. For something longer-lasting, acid-reducing medications work in two main ways. One type blocks a signal that tells your stomach to produce acid, providing roughly four hours of reduced acid output. The other type shuts down the acid-producing pumps directly and can keep stomach acid suppressed for 15 to 22 hours. The pump-blocking type is more effective overall but takes a day or two to reach full strength, so it’s better as a daily strategy than a one-night fix.
Signs That Need Medical Attention
Most nighttime stomach pain is annoying but not dangerous. However, certain patterns warrant a call to your doctor: pain that is severe, unexplained, or doesn’t improve over days. Blood in your stool, urine, or vomit. Persistent nausea or vomiting. Swelling or tenderness in your abdomen. Yellowing of your skin or eyes. Unintentional weight loss. Or pain that comes with a fever that won’t break or shortness of breath. These can signal conditions like bleeding ulcers, gallbladder disease, or pancreatitis that require more than lifestyle adjustments.

