Content
Enjoy sex like you used to

Reviewed by Kelly Brown MD, MBA
Written by Geoffrey C. Whittaker
Published 05/04/2022
Updated 05/06/2024
While not all sexually transmitted diseases (STDs) are linked to erectile dysfunction (ED), there are some STDs that cause erectile dysfunction — at least indirectly. STDs such as gonorrhea, chlamydia, viral hepatitis and HIV can cause infections in your prostate, which may affect your erections and ability to have sex.
Below, we discuss how infection can cause erectile dysfunction and which STDs may impact your sexual function and ability to get an erection. We also offer some tips on what you can do if you have ED, from using prescription medication to making changes to your lifestyle and more.
Content
While the majority of STDs don’t appear to have any direct impact on your ability to get an erection, some may cause or contribute to other health issues that can cause ED. Specifically, STDs — also known as sexually transmitted infections (STIs) — like HIV, viral hepatitis, gonorrhea and chlamydia may cause infections that could trigger erectile dysfunction.
For example, some infections spread through sex have the potential to cause prostatitis, a form of inflammation that affects your prostate gland. If this inflammation becomes severe, there’s the risk it could make it difficult for you to maintain an erection firm enough for sex.
Prostatitis can also cause other urinary and sexual symptoms, including pain while urinating or ejaculating. These issues can affect both your sexual functioning and day-to-day quality of life.
In addition to affecting your prostate gland, some sexually transmitted diseases can cause male accessory gland infections (MAGIs). These infections may result in inflammation and damage to your urethra, epididymis, testes and seminal vesicles, which in turn can have a negative effect on sexual function and fertility.
Even sexually transmitted diseases that don’t physically cause erectile dysfunction may have a significant effect on your psychological well-being, including your level of confidence in bed.
Researchers have found that having an STD can have an adverse psychological impact on the sexual function of men. This may include issues like sexual performance anxiety, as well as a general decrease in sex drive and avoidance of sexual encounters.
In other words, even when an STD doesn’t physically stop you from getting an erection, it could cause you to develop psychological erectile dysfunction.
In some cases, yes. Gonorrhea — a bacterial infection that spreads through sexual contact — is one of several bacterial STDs that can spread to your prostate gland and cause you to develop the symptoms of erectile dysfunction.
Common symptoms of gonorrhea in men include:
White, yellow or green discharge from the penis
Pain, discomfort and a burning sensation when urinating
Swollen and/or painful testicles
Gonorrhea is treatable with antibiotics, making it important to talk to your healthcare provider if you start to experience any of the above symptoms.
Because chlamydia can spread to the prostate gland, it also has the potential to cause prostatic inflammation that may contribute to or be a cause of ED.
Chlamydia is an infection caused by the bacteria Chlamydia trachomatis. Like other STDs, it’s typically spread through sexual contact.
Not all people who have chlamydia develop symptoms. Men with symptomatic chlamydia may experience pain or tenderness that affects the testicles, a burning sensation while urinating and discharge from the penis and/or rectum.
Like gonorrhea, chlamydia is treatable. It’s important to talk to your healthcare provider as soon as possible if you notice any of the symptoms of chlamydia after sexual activity.
Other STDs may play a role in the development of chronic health issues that affect your sexual health and contribute to long-term sexual dysfunctions.
For example, hepatitis C (or other forms of viral hepatitis) is associated with an increased risk of several forms of cancer, including prostate cancer. Although prostate cancer doesn’t directly cause ED, most forms of treatment for prostate cancer, including surgery, can contribute to erectile dysfunction.
Other sexually transmitted diseases, such as HIV, can attack your immune system and prevent it from functioning properly. This may increase your risk of developing infections that affect the penile tissue, causing erectile dysfunction.
Currently, there’s limited evidence that syphilis or human papillomavirus (HPV) have any impact on erections. However, one study has found that the herpes simplex virus (HSV) is associated with an increased risk of erectile dysfunction.
Catching a sexually transmitted disease can be a stressful and frustrating experience — especially when it also causes you to develop erectile dysfunction.
The good news is that erectile dysfunction and most STDs are curable, usually with a course of antibiotics and changes to your habits. Below, we discuss what you can do if you have a sexually transmitted disease that you think is causing erectile dysfunction.
Many STDs can have a negative impact on your health if they’re left untreated. Some can even contribute to infertility, either for you or your sexual partner. Further, the longer you wait to treat an STD, the more opportunities you have to potentially transmit it to other people.
Because of this, it’s important to treat your sexually transmitted disease before you even start to think about treating erectile dysfunction.
If you think you have an STD, it’s important to talk to your primary care provider as soon as you can. Most STDs can be checked for with a simple test, allowing you to find out if you have anything (and if so, what it is) within a few days.
If you have a sexually transmitted disease, your primary care provider may prescribe medication to cure the infection and restore your normal sexual health.
It’s also important to get tested for STDs on a frequent basis if you’re sexually active and to practice safe sex.
If you still find getting an erection difficult after treating an STD, you may want to consider using ED medication to improve your erections and sexual performance. Currently, four medications are available to treat ED: sildenafil (the active ingredient in Viagra®), tadalafil (Cialis®), vardenafil (Levitra®) and avanafil (Stendra®).
These medications, which belong to a class of drugs called PDE5 inhibitors, work by increasing blood flow to your genital region and penis. This improvement in blood flow can make it easier to get and maintain an erection sufficient for satisfying, pleasurable sex.
In addition to treating any sexually transmitted diseases and using ED medication, there are a simple changes you can make to your habits and daily life that can also improve your erectile health:
Get plenty of physical activity, even if it just means going for a daily walk or bike ride.
Maintain a healthy body weight, especially if you’re currently overweight or obese.
Eat a healthy, balanced diet that’s rich in fresh fruits, vegetables and lean proteins.
If you have hypertension (high blood pressure) or diabetes, keep them under control.
Limit your alcohol intake by drinking in moderation and avoiding irresponsible drinking, as this can be among the causes of erectile dysfunction.
Avoid using illicit drugs, as these may affect your sex drive and sexual function.
If you smoke, make an effort to quit to improve your cardiovascular wellbeing.
Consider working with a therapist if you’re dealing with anxiety or depression, as mental health and ED are connected.
Our list of ways to protect your erections naturally shares other lifestyle changes and healthy habits to explore for better erections and sexual performance.
Sexually transmitted diseases can have a serious impact on your health. In some cases, they can even affect your ability to get and maintain an erection.
If you think you might have gonorrhea, chlamydia or any other STD, it’s important to speak to your healthcare provider as soon as possible. They’ll be able to test you for any STDs and, if necessary, prescribe medication to get rid of the infection.
In addition to getting yourself tested and treated, it’s also important to let your recent partners know about your current situation, especially if you have an STD that could cause infertility or long-term health problems.
If your erectile dysfunction persists after you treat your STD, you may want to consider taking medication to improve your erections. We offer a range of proven ED medications, which are available following an online consultation with a licensed healthcare provider.
Hims & Hers has strict sourcing guidelines to ensure our content is accurate and current. We rely on peer-reviewed studies, academic research institutions, and medical associations. We strive to use primary sources and refrain from using tertiary references. See a mistake? Let us know at blog@forhims.com!
This article is for informational purposes only and does not constitute medical advice. The information contained herein is not a substitute for and should never be relied upon for professional medical advice. Always talk to your doctor about the risks and benefits of any treatment. Learn more about our editorial standards here.
Erectile Dysfunction
Premature Ejaculation
Low Testosterone
Retrograde Ejaculation
Pelvic Floor Dysfunction
Anorgasmia