“Ask your doctor if your heart is healthy enough for sex.”

You’ve probably heard this line as a medical disclaimer on TV or the butt of a joke. But there really is a strong connection between heart health and sex.

Recent research shows that the question isn’t just whether your heart is strong enough for sex. To the contrary, new evidence suggests that sexual activity, even after a heart attack, actually improves your chances of surviving for years to come.

The relationship between sex and health

Getting hot and heavy is a mild to moderate form of exercise with all of the immune and metabolic advantages that entails, but it’s a unique one with benefits of its own. Frequent sexual activity, especially in a relationship with a steady partner, has been linked to lower stress levels, lower blood pressure, pain relief and more.

Frequent sex has also been tied to a decrease in cardiovascular disease. This suggests that sexual activity may help prevent heart attacks in the first place.

When asked about the cardiovascular benefits of sex, Kristin Mark, PhD, director of the University of Kentucky’s Sexual Health Promotion Lab, told TIME magazine : “People who have healthy sex lives probably have overall healthy lifestyles. Sex helps regulate hormones like estrogen and testosterone, which impacts all kinds of systems in the body, including the heart.”

The case for sex after a heart attack

How to handle sex in the face of heart disease is a common question. The consensus seems to be that as long as your heart isn’t abnormally weak and you’ve completed any necessary rehab, the risks are minimal and the benefits may be significant.

Michael Blaha, MD, director of clinical research at the Johns Hopkins Ciccarone Center for the Prevention of Heart Disease, told Hopkins Medicine magazine, “As long as your doctor has given you the go-ahead and you aren’t experiencing any symptoms, it’s OK to return to your normal activities. … [F]or people with a stable heart, the long-term benefits of regular physical activity — including sex — far outweigh the risks.”

The data backs up this advice. According to a new study published by the European Society of Cardiology and covering over-65 patients at eight Israeli medical centers, frequent sexual activity within the first few months after a heart attack was associated with longer life expectancy. The improvement was present regardless of how often people had been having sex before their heart attack.

The take-home

An ounce of prevention can be worth a pound of cure, so be careful when setting out to have sex after a heart attack. Every individual is different. The best course of action is to consult your doctor for advice tailored to you. Don’t be afraid or too embarrassed to ask. There’s ample evidence that sex can help improve your health and your lifespan, and if it turns out you aren’t healthy enough for sex, then that’s something you should know, too.

Sean Marsala is a health writer based in Philadelphia, Pa. Passionate about technology, he can usually be found reading, browsing the internet and exploring virtual worlds.