Fact: One in two women is familiar with the feeling of passing an icicle made of hot lava through their urethra… only to discover that the culprit is exactly one drop of pee. And one in three women will take antibiotics for a UTI by the age of 24, and zero of them are likely to recommend the experience to a sworn enemy. Urinary tract infections are so common and so awful that I’m afraid of manifesting one right now just by writing about it.

To be clear, writing does not actually cause UTIs, but having lots of sex can! More accurately, research has found that an active sex life increases the chances of a UTI, which makes sense when you find out what bacteria is the culprit behind most infections. “Typically, the bacteria that cause UTIs originate from fecal flora,” says Alex Shteynshlyuger, M.D., the director of urology at New York Urology Specialists. More than 60 percent of urinary tract infections can be attributed to E.coli, which lives in the intestines, then makes its way down and out. The proximity of the female anus to the vagina makes it more likely that bacteria will find its way to your relatively short urethra and then travel up the urinary tract to your bladder.

“When bacteria makes it into the bladder, it’s able to invade the body’s immune defenses and cause an inflammatory reaction,” Shteynshlyuger says. And “inflammatory reaction” is a much nicer way to describe the painful symptoms, including the aforementioned lava icicle—along with urgent, frequent bathroom runs and foul-smelling pee.

Though urinary tract infections can be attributed to a plethora of other factors, including kidney stones, tight clothing, and genetics, being mindful of what you do before and after sex is a good way to minimize the risk of getting one.

1. Chug Some H20

The easiest thing you can do? Stay hydrated, says Jessica Shepherd, M.D., OB/GYN and founder of Her Viewpoint. “Increasing your water intake (and then expelling said water) helps flush the system of bacteria and keeps it from sitting in the bladder and accumulating.”

2. Pee It Out

Though only a handful of studies have found a correlation between peeing after sex and a lower instance of urinary tract infections, peeing after sex can potentially flush out bacteria before it has a chance to travel up your urinary tract and get cozy in your bladder. “Since there is no cost to pee, it’s always a good idea, especially for someone who gets frequent UTIs,” Shteynshlyuger says. And on the flip side, holding in pee gives bacteria time to fester and multiply in your bladder, which can contribute to infections.

3. Wash It Off

“Proper hygiene, like always wiping front to back after using the bathroom can help keep bacteria at bay as well,” Shepherd says. One study found that wiping the wrong way increased your risk of a UTI by 64 percent. Just don’t go crazy trying to disinfect your genitals and stay far away from vaginal douches. Douches wipe out the good bacteria that live in vaginas, which messes up the flora and pH balance, leaving you at risk of infection. Also, spermicide with nonoxonyl-9 can cause tiny microabrasions in the vagina, which can lead to an infection—so stick to other forms of birth control.

And even if you’ve wiped, cleaned, hydrated, and peed religiously, you could still end up with with a urinary tract infection. The good news is that most UTIs resolve quickly. “The immune system is very good at fighting off UTIs, and often symptoms resolve spontaneously within one to three days without antibiotics,” Shteynshlyuger says. “Though they can cause a good amount of misery.”

A course of antibiotics should wipe away all UTI-related misery, but if your infection keeps coming back and seems to be sex-related, both Shteynshlyuger and Shepherd agree that taking a small dose of antibiotics after sex is a solution you and your doctor could discuss to help prevent full-blown infections in the future.

Keep in mind that there are also a host of other problems that can have symptoms similar to urinary tract infections, including some sexually transmitted diseases and interstitial cystitis, a chronic condition affecting the bladder. Once other possible issues are ruled out, it’s a good idea to see a urologist and make sure there are no anatomical problems that predispose you to urinary tract infections, such as incomplete bladder emptying and kidney or ureteral stones, Shteynshlyuger says.

And if you suspect you have a UTI, it’s better to get checked sooner than later—untreated UTIs can sometimes progress to a kidney infection. While this is unlikely, it can be serious, so it’s worth making time to go get it checked out.