Erectile dysfunction (ED) is a condition in which it’s difficult to get or keep a firm erection long enough to have sex. Though prevalence estimates vary, experts agree that ED is a fairly common problem.

If it happens once in a while, there’s generally no reason for concern. When it happens a lot, it can lead to stress, anxiety, and relationship issues. There are various ways to treat ED, but the right treatment method depends on the cause.

Getting an erection is a complex process that involves your body’s nerves, blood vessels, and hormones. Let’s look at some of the causes of ED and possible treatment options.

There are a variety of physical and psychological factors that can contribute to ED. It can even involve a combination of physical and emotional causes.

Lifestyle factors

Certain health issues and lifestyle factors can contribute to ED. Modifiable risk factors include:

Drugs can also sometimes cause ED. These include:

  • amphetamines
  • barbiturates
  • cocaine
  • heroin
  • marijuana

If one of these factors applies to you and you can make the necessary adjustments, you may be able to improve your ability to get and maintain an erection. If you aren’t able to change them on your own, ask your doctor for help.

Medical factors

Sometimes, ED is a sign of an underlying health condition that can be treated. The following health conditions can cause ED:

ED can be a result of surgery or injury to the:

  • bladder
  • pelvis
  • penis
  • prostate
  • spinal cord

ED can be a side effect of certain medications, such as:

  • antiandrogens
  • antidepressants
  • antihistamines
  • appetite suppressants
  • blood pressure medications
  • chemotherapy medications
  • opioids
  • sedatives and tranquilizers
  • ulcer medications

Emotional and psychological conditions that can lead to ED include:

If you still wake up in the morning with an erection, your body is physically capable of producing an erection and the underlying issue may be psychological.

In many cases, there’s no one simple cause of ED, but rather a combination of factors. For example, someone taking medications for diabetes and high blood pressure could have ED as a result of those medications and the underlying diseases. Stress could make the ED worse, which may lead to more stress.

Although there are many claims about instant cures for ED, there isn’t a quick fix. If you’re shopping for help online, here are a few things to keep in mind:

  • A supplement may be natural, but that doesn’t necessarily mean it’s safe. Supplements can interfere with other medications or aggravate underlying health conditions. It’s best to talk to your doctor before taking them.
  • Products advertised as “herbal Viagra” may contain other medications not mentioned on the label, as well as unknown doses of herbs and medications.
  • ED can be a sign of an underlying health condition that should be treated. Because of this, it’s important to see your doctor for a complete checkup rather than trying to fix the problem on your own.

You can start with your primary care physician, but you may need to see a urologist. Let them know how long you’ve been experiencing ED and how it’s affecting you. Be prepared to share:

  • your complete medical history
  • any prescription or nonprescription medications you take
  • whether you smoke
  • how much alcohol you consume
  • how much exercise you get
  • any emotional and psychological conditions

To diagnose or rule out underlying conditions, you may need:

  • a complete physical examination
  • blood and urine tests to look for signs of heart disease, diabetes, and other conditions
  • imaging tests, such as an ultrasound, to check the blood vessels that supply the penis

Your doctor may ask about your emotional health to look for signs of anxiety, depression, and other psychological conditions.

You may also be asked to take a nocturnal erection test in which you wear a device around your penis to see if you have an erection while you sleeping. Another test, called intracavernosal injection, involves injecting a drug into the penis to create an erection to see how long it lasts.

Since there may be multiple contributing factors, lifestyle considerations should be included as part of your treatment plan. For example:

  • If you smoke, consider quitting. If you have trouble doing so on your own, ask your doctor about smoking cessation programs to help you stop.
  • If you’re overweight, talk to your doctor about diet and exercise changes that can help manage weight.
  • If you drink alcohol, stop or limit how much you drink.
  • If you use drugs that haven’t been prescribed to you by a doctor, talk to your doctor about programs to help you quit.

If you suspect a prescribed medication is causing ED, don’t stop taking it without your doctor’s approval. Instead, talk to your doctor about lowering the dose or finding an alternative medication.

Oral medications

Phosphodiesterase type 5 inhibitors (PDE5i) are oral medications that can help you have an erection that lasts. These include:

These medications relax the muscles in the penis and encourage blood flow to the penis in response to sexual stimulation. They begin to work in 30 minutes to an hour and can last several hours. But these medications don’t cause an erection by themselves. You’ll still need sexual stimulation, after which the medications will make it easier to get and keep an erection.

You may not be able to take these medications if you:

  • take nitrates to treat a heart condition
  • take alpha-blockers to treat an enlarged prostate or high blood pressure
  • have low blood pressure
  • have severe heart failure

Side effects can include:

  • flushing
  • headache
  • nasal congestion
  • upset stomach
  • visual changes
  • dizziness
  • backache

A rare but potentially serious side effect of PDE5is is priapism, or having an erection that lasts for more than 4 hours. This is a medical emergency.

Testosterone

If ED is caused by low levels of testosterone, your doctor can prescribe testosterone replacement therapy. This won’t help if you have a normal testosterone level, though. It’s also not a good option for ED that’s caused by circulatory or nerve issues.

Alprostadil

When self-injected into the penis, alprostadil causes the penis to fill with blood. This medication is also available as a suppository that’s inserted into the urethra. You’ll get an erection within 5 to 20 minutes, and it lasts 30 minutes to an hour. It’s also available as a topical cream. Brand names include:

  • Caverject
  • Caverject Impulse
  • Edex
  • Prostin
  • MUSE

Side effects can include priapism.

ED pump

Your doctor can prescribe an ED vacuum pump, which pulls blood into the penis. The device involves the use of:

  • a plastic tube placed around the penis
  • a vacuum pump to draw air out of the tube
  • an elastic ring at the end of the tube, which you move to the base of the penis when you remove the tube

The ring helps maintain the erection and can stay on for 30 minutes. The ED pump may cause some bruising of the penis.

Surgery

If other treatments don’t work well, there are a few surgical options:

  • An inflatable implant can be placed in the penis. When the pump implanted in the scrotum is pressed on, fluid from a reservoir in the pelvis fills the implant. This makes your penis longer and wider.
  • Malleable implants can be put in the penis. These can be used to manually adjust the position of the penis.
  • In rare cases, arteries can be repaired, improving blood flow.

Therapy

Consider seeing a mental health professional if ED is caused by or is causing psychological conditions such as:

  • stress
  • anxiety
  • depression
  • relationship issues

There are many ways to approach treatment for ED, including some important lifestyle modifications. Your treatment plan depends on many factors, which is why it’s essential to see your doctor if you’re experiencing ED. In many cases, ED is reversible or treatable.