In many cases, stomach pain after sex results from gas or deep penetration. Although neither of these conditions are life-threatening, the pain they cause can certainly put a damper on things.

Dyspareunia — pain during or after penetrative sex — is common. It affects 10 to 20 percent of women in the United States. In a study, up to 5 percent of men also experienced dyspareunia.

It’s also treatable. After assessing your symptoms, your doctor can recommend therapies that will get you back between the sheets, pain-free.

Here’s what to watch for and when to see your doctor.

In some cases, stomach pain results from outside stressors or the position you’re in. It could also be a sign of an underlying condition:

Emotional reaction

Sex can stir up all kinds of feelings, ranging from excitement to anxiety, all of which can affect your stomach. Relationship issues, daily stress, and anxiety about sex can cause your abdominal and pelvic muscles to tense up or result in gastrointestinal distress.

Deep penetration

Deep penetration can also cause pain after vaginal and anal sex. This pain is usually temporary and should clear when you change positions or allow your body to rest. You can prevent future pain by trying a different position or avoiding deep thrusting.

Orgasm

Your pelvic muscles contract during orgasm. For some people, these contractions result in painful muscle spasms in the lower abdomen and pelvis. Pain during or after orgasm is also known as dysorgasmia.

Dysorgasmia is more common in people who:

A 2013 study also linked low-dose birth control pills to pain during and after orgasm.

Gas

Penetrative sex can push air into the vagina or anus. If the air becomes trapped, you may experience gas-related pain in your upper abdomen or chest.

Gas pain tends to feel like it’s moving, so this pain may radiate to other areas. Your symptoms should subside once you expel the gas.

Urinary tract infection (UTI)

UTIs typically involve the lower portion of your urinary tract. This includes your bladder and urethra.

Along with pelvic and abdominal pain, you may experience:

  • pain or burning during urination
  • increased urinary frequency
  • cloudy urine
  • bloody urine
  • rectal pain

Sexually transmitted infection (STI)

STIs such as gonorrhea and chlamydia are often asymptomatic. When they do cause symptoms, abdominal pain is possible.

You may also experience:

  • a tender pelvic area
  • pain or burning during urination
  • unusual discharge
  • foul odor

Interstitial cystitis

Also called painful bladder syndrome, interstitial cystitis can cause chronic pain in your pelvis or lower abdomen. This pain may intensify during or after sex.

You may also experience:

  • frequent urination, usually in small amounts
  • feeling like you need to urinate even after emptying your bladder
  • incontinence, or accidental urine leakage

Irritable bowel syndrome (IBS)

IBS causes a range of gastrointestinal symptoms, including gas and cramping, that can result in stomach pain. Constipation can be especially painful during or after penetrative sex.

Other symptoms of IBS include:

Some conditions are specific to the female reproductive system.

Uterus position

According to the International Society for Sexual Medicine, 20 to 30 percent of women have a tilted uterus. If your uterus is tilted, it’s more likely to be touched during penetration.

This may result in unexpected abdominal pain during and after sex. Pain is often associated with rear-entry positions and deep thrusting.

Ovarian cyst

Ovarian cysts are fluid-filled sacs that can develop in or on the surface of your ovaries. They usually disappear on their own within a few months.

Although they’re usually painless, large cysts can result in lower abdominal pain. This pain may intensify during or after penetration.

Other symptoms include:

  • bloating
  • nausea
  • vomiting

Uterine fibroids

Uterine fibroids are common, noncancerous growths. They don’t always cause symptoms. When they do, symptoms can vary according to fibroid size and location.

For some people, vaginal penetration can provoke or intensify pelvic and lower abdominal pain.

Other symptoms can include:

  • heavy bleeding between or during your period
  • periods that last more than a week
  • constipation
  • back or leg pain

Pelvic inflammatory disease (PID)

PID is a bacterial infection of the female reproductive organs. It’s often associated with the same bacteria that causes gonorrhea and chlamydia.

In addition to abdominal pain, PID can cause:

  • bleeding during sex
  • spotting between periods
  • unusual discharge
  • foul odor
  • fever

Endometriosis

With endometriosis, the tissue that lines the uterus begins to grow elsewhere. The tissue often extends to the ovaries and fallopian tubes. In some cases, the tissue spreads beyond the pelvis.

This overgrowth of tissue can cause pain in the stomach, pelvis, and lower back. This pain may intensify after penetration.

You may also experience:

  • painful bowel movements or urination
  • heavy bleeding between or during your period
  • painful periods

Blockage of fallopian tube

Your fallopian tubes connect your ovaries and uterus. Every month, the tubes carry an egg from an ovary to your uterus in preparation for fertilization.

If one or both of the tubes becomes blocked by fluid or tissue, it may cause mild pain on that side of your abdomen. Some people don’t experience any symptoms and only discover the blockage after having difficulty conceiving.

Some conditions are specific to the male reproductive system.

Prostatitis

Prostatitis refers to swelling of the prostate gland. The prostate is a walnut-sized gland just below the bladder that produces semen. In the United States, between 10 and 15 percent of people with a prostate are affected.

In addition to lower abdominal and pelvic pain, some people experience pain during or after ejaculation.

Other symptoms include:

  • chronic pain in the lower back, anus, or scrotum
  • pain during and after urination
  • constant urge to urinate
  • a weak urine stream

In many cases, stomach pain will fade without any treatment. Medical attention typically isn’t necessary for stomach pain that’s infrequent and unaccompanied by other symptoms.

You should see your doctor if you:

  • regularly notice stomach pain after sex
  • have pain so severe that it inhibits your ability to function
  • have a fever at or above 100.4°F (38°C)

Your doctor can assess your symptoms and determine whether they’re related to an underlying condition. They can also prescribe medication or recommend other therapies for relief.