Let’s face it, nothing is more annoying than being woken up mid-slumber because you have to go to the bathroom. While you may chastise yourself for drinking too much wine with dinner and vow never to do that again, your urgency to pee may have more to do with your genes than how much you drank before bed.

READ MORE: Four Ways to Prevent a UTI 

A team of Japanese researchers looked at the urination patterns of mice. What they found was that bladder muscle cells are often regulated by circadian rhythms, which is our internal sleep/wake cycle that can be influenced by our genes. A person with a normal circadian rhythm pees less at night so their body has time to rest and restore without being disturbed. But mice with an abnormal circadian rhythm peed just as much during the day as they did at night, according to the research published in Nature Communications.The researchers also found that a specific protein, Cx43, which is found in bladder muscle cells and largely controlled by our genes, can determine how much urine your bladder can hold and how often you have to pee. The mice with lower levels of the Cx43 protein had to pee more frequently during the night, leading some to believe that our genes could very well be responsible for those annoying, have-to-pee 2a.m. awakenings. Thanks, Mom and Dad!

Occasionally having to pee at night or even having to go once a night isn’t considered to be much of an issue, according to Beri Ridgeway, M.D., a urogynecologist at the Cleveland Clinic. “The issue becomes problematic when that happens two or more times a night—that’s called nocturia [or nocturnal polyuria],” she explains. “It’s waking with the need to urinate, and it’s so strong that you can’t go back to sleep until you empty your bladder.”And while our bladder strength and capacity does change as we age, it’s important to find out what is causing those midnight disruptions. Dr. Ridgeway says that can range from sleep apnea to a small bladder, and yes, possibly, our genes.

READ MORE: Is It Just Snoring or Sleep Apnea?

“Down the road, we may be able to harness the [Cx43 protein] idea as a treatment,” says Ridgeway, “by regulating those genes to produce more or less of that protein, which can change the amount of urine that the bladder can hold.”

In the meantime, if your doctor has ruled out any medical issues, here are some tips that may help you get a good—and uninterrupted—night’s sleep:

1. Put down that drink. Reducing the amount of fluid you drink before you hit the hay is an obvious solution to urinating less during the night. In particular, watch out for diuretics such as alcohol and caffeine, which can actually increase the urgency to pee. Avoid them starting four hours before bedtime.

2. Alleviate leg swelling. Believe it or not, elevating swollen legs so they’re level with your heart a couple of hours before bedtime can reduce the urgency to urinate during the night. “When we lie down, we absorb all of the fluid from those swollen tissues, which then goes to the kidneys for urine production,” explains Ridgeway. By releasing that extra fluid before bedtime, you can reduce the likelihood of having to use the bathroom later on.

READ MORE: Want Better Sex, Ladies? Get More Sleep

3. Get checked out. If you suspect that you have an overactive bladder, talk to your doctor. There are medications and even physical therapy that can reduce the frequent urgency to go.

4. Reset your internal clock. By adjusting your circadian rhythms to a normal and predictable sleep/wake cycle each day, you may be able to limit nighttime urination.

5. Step away from the salt shaker. Loading up on salt and eating foods that are heavy in sodium  (think: frozen meals, cured meats and soy sauce) as well as protein and potassium can cause your body to store extra fluid and increase urine production during the night, according to Ridgeway. Your best bet? Avoid heavily salted foods, particularly at night, which is smart to do anyway.

6. Work it out. Exercise helps regulate your circadian rhythms, which is part of the equation for getting a good night’s sleep, notes Ridgeway. Working out also helps you lose any excess weight. That’s important since obesity is linked to poor sleep and sleep apnea.

QUIZ: How Much Quality Sleep Are You Getting?