Difficulty getting or staying hard is one of the most common sexual health issues men experience, and it rarely has a single cause. About 18% of men aged 18 to 24 meet diagnostic criteria for erectile dysfunction, and prevalence climbs with each decade, reaching roughly 25% by the mid-40s and nearly 50% by the mid-70s. Whether this is happening to you occasionally or consistently, understanding the physical and psychological mechanisms behind it can help you figure out what’s going on and what to do next.
How Erections Actually Work
An erection is fundamentally a blood flow event. When you’re aroused, nerve endings in the penis release a signaling molecule called nitric oxide. This triggers a chain reaction that relaxes the smooth muscle inside the shaft, allowing the spongy tissue to fill with blood. The expanded tissue then compresses the veins that would normally drain blood away, keeping the penis firm.
Anything that disrupts this process, whether it’s nerve signaling, blood vessel health, hormone levels, or mental state, can make it harder to get or stay erect. That’s why erection problems are so common: there are many points in the chain where things can go wrong.
Blood Vessel Health Is the Biggest Factor
The arteries supplying the penis are small, only 1 to 2 millimeters wide. That makes them among the first blood vessels in the body to show damage from conditions like high blood pressure, high cholesterol, and diabetes. In many cases, erection problems are an early warning sign of cardiovascular disease that hasn’t been detected yet.
A Johns Hopkins study that followed more than 1,900 men over four years found that those with erectile dysfunction were nearly twice as likely to experience heart attacks, cardiac arrests, or strokes, even after accounting for other risk factors. Among men with ED, 6.3% experienced a major cardiovascular event compared to 2.6% of men without it. This doesn’t mean erection problems guarantee heart trouble, but it does mean your vascular system deserves attention if you’re having persistent difficulty.
Stress and Anxiety Can Block the Response
Your nervous system has two competing modes: the “fight or flight” response (sympathetic) and the “rest and digest” response (parasympathetic). Erections require the parasympathetic system to be in charge. When you’re anxious, stressed, or overthinking your performance, your body activates the fight-or-flight response instead. This diverts blood away from non-essential functions, including erections, and toward your muscles and heart.
If stress persists, your body starts pumping out cortisol, the primary stress hormone. Cortisol suppresses testosterone, which plays a role in sex drive and may contribute to the blood flow changes needed for an erection. This creates a frustrating cycle: you have trouble getting hard, which makes you anxious about the next time, which makes it even harder. Performance anxiety is especially common in younger men and in new sexual relationships.
The telling clue here is context. If you can get hard on your own, during sleep, or when you wake up in the morning, but struggle during sex, the cause is more likely psychological than physical.
Smoking Does Direct Damage
Nicotine attacks erectile function from multiple angles. It damages the lining of blood vessels, reduces nitric oxide production (the key chemical that triggers erections), raises blood pressure, and increases sympathetic nervous system activity. The damage follows a dose-response pattern: the more you smoke, the worse it gets.
Cigarette smoke also generates free radicals that cause oxidative damage to the cells lining your arteries, triggering inflammation and impairing the vessels’ ability to relax and expand. Over time, this can cause permanent structural changes in the penile blood vessels. The good news is that quitting smoking allows some of this damage to reverse, and many men notice improvements in erectile function within months of stopping.
Medications That Interfere
A surprisingly long list of common medications can cause or worsen erection problems. The most frequent culprits fall into a few categories:
- Blood pressure medications: Thiazide diuretics (water pills) are the most common cause, followed by beta-blockers. If you started a new blood pressure medication and noticed changes, this connection is worth discussing with your prescriber.
- Antidepressants: SSRIs and older antidepressants frequently affect sexual function. This includes widely prescribed medications for depression and anxiety.
- Opioid painkillers: Both prescription and illicit opioids suppress testosterone and can significantly impair erectile function.
- Antihistamines: Some over-the-counter allergy and heartburn medications can contribute, including common brands for motion sickness and allergies.
- Hair loss treatments and prostate medications: Drugs that block the conversion of testosterone can affect erections in some men.
If you suspect a medication is involved, don’t stop taking it on your own. There are often alternative drugs in the same class that are less likely to cause sexual side effects.
Testosterone’s Role Is Real but Overstated
Low testosterone gets a lot of attention, but its relationship with erection problems is more nuanced than supplement ads suggest. The American Urological Association defines low testosterone as a total level below 300 ng/dL. Men below this threshold are more likely to have erectile issues, and the risk increases as levels drop further: men below 231 ng/dL have roughly double the odds of ED compared to men with normal levels.
However, a pooled analysis of 29 studies found that the average testosterone difference between men with and without ED was only about 47 ng/dL. Testosterone plays a bigger role in sex drive than in the physical mechanics of getting hard. If your desire is fine but erections are the problem, testosterone alone is unlikely to be the full explanation. Still, it’s worth having your levels checked, especially if you’re also experiencing fatigue, low mood, or reduced muscle mass.
Sleep Problems and Morning Erections
Healthy men typically have three to five erections during sleep, triggered during REM cycles. These nocturnal erections are one reason you might wake up hard in the morning. When they disappear, it can signal an underlying physical issue.
Sleep apnea is a major and underrecognized contributor. Among men with obstructive sleep apnea, the rate of erectile dysfunction may be as high as 92%, compared to about 52% in the general population. The repeated drops in oxygen during apnea episodes damage blood vessels, increase inflammation, and can lower testosterone. Treating sleep apnea with a CPAP machine has been shown to reduce ED in some studies. If you snore heavily, feel exhausted despite sleeping enough hours, or your partner has noticed you gasping at night, this is worth investigating.
Alcohol and Other Lifestyle Factors
Alcohol in small amounts can lower inhibitions and reduce anxiety, which might actually help in the short term. But more than a couple of drinks depresses the central nervous system, impairs nerve signaling, and makes it physically harder to get and maintain an erection. Chronic heavy drinking causes longer-term damage to blood vessels and can lower testosterone levels.
Being significantly overweight also raises ED risk through several pathways: it increases inflammation, contributes to blood vessel damage, and excess body fat converts testosterone to estrogen. Regular physical activity, particularly aerobic exercise, is one of the most effective lifestyle changes for improving erectile function because it directly improves blood vessel health and nitric oxide production.
What the Pattern Tells You
Pay attention to when and how the problem shows up. If you can get hard during masturbation or wake up with morning erections but struggle during partnered sex, the issue is more likely anxiety or relationship-related. If erections are consistently difficult regardless of the situation, a physical cause is more probable. If the problem came on gradually over months or years, that points toward vascular or hormonal changes. If it appeared suddenly, medications, stress, or a new life situation are more likely explanations.
Most men experience occasional difficulty, and a single off night doesn’t mean anything is wrong. Fatigue, alcohol, distraction, and stress all cause temporary problems that resolve on their own. When the pattern is persistent, lasting more than a few weeks, it’s worth looking into the causes above and getting a basic health screening that includes blood pressure, blood sugar, cholesterol, and testosterone levels.

