Why Can’t I Get Hard During Sex? Causes Explained

Trouble getting hard during sex can stem from anxiety, heart health, hormones, or medications. Here’s how to figure out what’s going on.

Difficulty getting or keeping an erection during sex is one of the most common sexual health complaints, and it almost always has an identifiable cause, whether physical, psychological, or some combination. The list of contributing factors is long: anxiety and stress, poor cardiovascular health, diabetes, certain medications, hormonal shifts, alcohol, sleep problems, and more. Understanding which category your difficulty falls into matters, because the path to fixing it depends entirely on what is driving it.

What Has to Go Right for an Erection to Happen

An erection is a hydraulic event that requires coordination between your brain, nerves, blood vessels, and smooth muscle tissue inside the penis. When you become aroused, nerve signals trigger the release of nitric oxide in the erectile tissue. That nitric oxide causes the smooth muscle lining the blood-filled chambers of the penis to relax, allowing blood to rush in and expand the tissue. The expanding tissue then compresses the veins that would normally drain blood away, trapping it inside and producing rigidity. A problem at any step in this chain, from the initial arousal signal in the brain to the blood vessel response in the penis, can prevent or weaken an erection.

Performance Anxiety and the Mental Feedback Loop

If you can get erections when you are alone, during sleep, or while watching something arousing but lose them the moment a partner is involved, your difficulty is likely psychological. Performance anxiety is the single most common psychological cause, and it creates a vicious cycle that can feel impossible to escape. The moment you start worrying about whether you will stay hard, your body shifts into a heightened sympathetic nervous state, the same fight-or-flight response that prepares you to deal with a threat. Even subtle increases in this stress-driven arousal can be enough to shut down the erectile response.

A position statement from the European Society of Sexual Medicine describes the pattern clearly: men who have experienced erectile difficulty walk into the next sexual encounter already expecting failure. They focus on monitoring their own body for signs of trouble instead of paying attention to erotic cues. That self-monitoring, combined with rising anxiety, further suppresses the physical arousal response and confirms the fear. The result is that one bad night can snowball into a recurring pattern, not because anything is physically wrong, but because your brain has learned to associate sex with stress.

This is often the explanation for men in their twenties and thirties who are otherwise healthy. New partners, relationship tension, pressure to perform, or even the transition from masturbation to partnered sex can all spark it. The good news is that psychogenic erectile difficulty tends to respond well to treatment, which we will get to later.

Pornography and Sexual Conditioning

Whether pornography directly causes erectile problems is a question researchers have gone back and forth on, but the recent evidence tilts toward a meaningful link, at least when use is frequent or compulsive. A large international survey of young men found that those with the highest scores on a problematic pornography consumption scale were nearly three times as likely to report erectile difficulty compared with those scoring lowest. A study of young Turkish men found that higher pornography use frequency correlated with worse erectile function scores even after controlling for depression, stress, and somatization.

The suspected mechanisms are both psychological and relational. Frequent pornography use may condition arousal to specific, escalating visual stimuli that real-life sexual encounters cannot replicate. It can also erode relationship quality and emotional connection with a partner, which in turn worsens sexual functioning. This does not mean every man who watches pornography will have problems. The risk seems concentrated among those whose use is heavy, compulsive, or has become the dominant mode of sexual experience. If you suspect this applies to you, reducing use and reorienting your arousal toward partnered interactions is a reasonable first step to try.

Blood Vessel Health and the Cardiovascular Connection

Erectile difficulty is now recognized by cardiologists as an early warning sign of cardiovascular disease. The arteries supplying the penis are smaller than those feeding the heart and brain, so they tend to show the effects of plaque buildup, high blood pressure, and endothelial damage earlier. When the lining of blood vessels is damaged, whether by high cholesterol, smoking, chronic inflammation, or uncontrolled blood pressure, those vessels lose their ability to dilate properly in response to nitric oxide. The same process that narrows coronary arteries narrows penile arteries, and it often shows up in the penis first, sometimes years before a cardiac event.

This is why erectile difficulty in a man over 40 who has no obvious psychological trigger should be taken seriously as a potential cardiovascular signal, not just a bedroom problem. A visit to the doctor is worth it even if you would rather not have the conversation.

Diabetes and Nerve Damage

Diabetes is one of the strongest predictors of erectile dysfunction. A systematic review of 145 studies found that roughly half of men with diabetes experience it, and a broader umbrella review placed the global estimate even higher, around two-thirds of diabetic men. Diabetes attacks erectile function from multiple directions at once. Chronically high blood sugar damages the small blood vessels needed for erections, degrades the nerves that carry arousal signals, and promotes inflammation that impairs the nitric oxide pathway. Diabetic neuropathy, the nerve damage caused by prolonged high glucose, was identified as one of the strongest standalone predictors of erectile difficulty in diabetic men, even more strongly associated than traditional cardiovascular risk factors.

If you have diabetes and are struggling with erections, tighter glucose control is the single most impactful thing you can do alongside any medical treatment for the erectile difficulty itself.

Medications That Interfere

Some of the most commonly prescribed medications have sexual side effects that patients are never warned about, or only learn about in the fine print.

If your erectile difficulty started shortly after beginning a new medication, that timing alone is a strong clue. Do not stop any prescribed drug on your own, but bring it up with your doctor. Switching to a different medication in the same class or adjusting the dose can often resolve the issue.

Alcohol and Recreational Drugs

Alcohol is the substance most likely to cause a one-off erection failure, and most men have experienced this at least once. In the moment, alcohol depresses the central nervous system and blunts the signals that produce arousal. But the damage goes deeper for heavier drinkers: research on men with alcohol use disorders consistently finds that greater quantity, frequency, and duration of drinking are linked to erectile difficulty, reduced desire, and delayed ejaculation.

Other substances carry their own risks. Cannabis, cocaine, amphetamines, and opioids all affect sexual functioning through different mechanisms, ranging from hormonal disruption to nerve suppression to vascular damage. Cocaine in particular is notorious for making users feel sexually confident while simultaneously impairing the physical ability to follow through. If substance use is a regular part of your sexual routine and you are having erection problems, reducing or eliminating that substance is the most obvious experiment to try before looking for other explanations.

Hormonal Causes

Low testosterone gets an outsized share of the blame for erectile difficulty in popular culture, and while it does play a role, the relationship is more nuanced than supplement ads suggest. Testosterone is important for sexual desire and arousal, and men with very low levels can experience both reduced libido and weaker erections. But many men with low-normal testosterone levels have perfectly functional erections, and many men with severe erectile difficulty have normal testosterone. Testosterone is more reliably linked to desire than to the mechanical ability to get hard.

Other hormonal causes are rarer but worth knowing about. Hyperprolactinemia, where the pituitary gland produces too much prolactin, can suppress testosterone and cause erectile problems. Men found to have low testosterone should have their prolactin checked, because a pituitary adenoma, while uncommon, is a treatable cause. Thyroid disorders can also contribute, with both an overactive and underactive thyroid linked to erectile abnormalities.

Sleep Apnea and Physical Inactivity

Two lifestyle factors deserve their own attention because they are extremely common and directly treatable. Obstructive sleep apnea, where breathing repeatedly stops and restarts during sleep, damages blood vessel function through the same oxidative stress pathway involved in cardiovascular disease. The repeated drops in oxygen during the night impair the body’s ability to produce nitric oxide, the molecule that drives erections. If you snore heavily, wake up feeling exhausted, or have been told you stop breathing in your sleep, getting evaluated for sleep apnea could improve your erections along with a long list of other health outcomes.

Physical inactivity is similarly impactful. A systematic review of randomized controlled trials found that aerobic exercise produced measurable improvements in erectile function, with the largest gains seen in men who had the most severe difficulty to begin with. The recommended dose, based on intervention studies, is moderate to vigorous aerobic exercise about four times per week, roughly 40 minutes per session, sustained over at least six months. That is roughly the same amount of exercise recommended for general cardiovascular health, which makes sense given the overlap between heart health and erectile health.

Nerve Injuries and Surgery

Any injury or surgery that damages the nerves running to the penis can cause erectile difficulty, and the most common culprit is prostate cancer treatment. After radical prostatectomy or radiation therapy for prostate cancer, erectile dysfunction is the leading complication after urinary incontinence. The nerve bundles that control erections run alongside the prostate, and even with nerve-sparing surgical techniques, temporary or permanent damage is common. The resulting nerve injury reduces oxygen delivery to the erectile tissue, which over time causes structural changes in the tissue itself.

Spinal cord injuries also commonly impair erections, along with other aspects of sexual function including ejaculation and orgasm. Pelvic surgery for bladder or colorectal cancer, certain spinal surgeries, and even cycling-related nerve compression can contribute as well. If your difficulties started after a surgery or injury, the cause is usually straightforward to identify, and treatment options exist even for nerve-damage cases.

How to Tell Whether the Cause Is Physical or Psychological

This distinction matters because it determines what kind of help will work best. A few clues can point you in the right direction. If you still get firm morning erections, or can get hard reliably when masturbating alone but not during partnered sex, the problem is more likely psychological. If your erections have been gradually declining across all situations, including solo activity and nighttime, a physical cause is more probable. When clinicians need to settle the question formally, one method involves monitoring nighttime erections, which occur during REM sleep in healthy men regardless of psychological state. Reduced nighttime rigidity points toward an organic cause.

In practice, many men have both physical and psychological factors operating at the same time. A mild physical impairment, say from early blood vessel changes, produces a couple of underwhelming erections, which then triggers performance anxiety, which makes the problem significantly worse. Untangling the two often requires addressing both sides.

What Actually Works for Treatment

The most widely used and effective frontline treatment is an oral PDE-5 inhibitor, which is the drug class that includes sildenafil (Viagra), tadalafil (Cialis), and vardenafil (Levitra). These drugs work by enhancing the nitric oxide signaling pathway described earlier, making it easier for blood to flow into the penis when arousal occurs. They do not create erections out of nothing; you still need sexual stimulation. Sildenafil can produce a usable erection within about 15 to 30 minutes of taking it and the effect can last around four hours. Tadalafil lasts considerably longer, which is why some men prefer it for more spontaneous use.

For psychogenic erectile difficulty, cognitive behavioral sex therapy is an evidence-based option. A pilot study comparing structured cognitive behavioral therapy to sildenafil found that the therapy performed similarly to the medication for improving erection scores and reducing depression related to sexual difficulty, and was actually more effective at reducing anxiety. Another randomized trial found that combining medication with cognitive behavioral therapy improved not only the man’s erectile function but also his partner’s sexual satisfaction and the couple’s overall relationship quality, outcomes that medication alone did not achieve. That finding makes intuitive sense: a pill can produce an erection, but it cannot fix the anxiety, relational tension, or negative thought patterns that may be driving the problem.

For men who do not respond to oral medication, other options include penile injections, vacuum erection devices, and surgical implants. These are less commonly needed but can be life-changing for men with severe vascular or neurological damage.

Aging and Gradual Tissue Changes

Getting older does not automatically mean losing erectile function, but it does stack the deck. With age, the tunica albuginea, the tough sheath surrounding the erectile chambers, can undergo collagenous changes and lose some of its structural integrity. This degradation can impair the tissue’s ability to trap blood effectively during an erection, a condition sometimes called venous leak. Age-related declines in testosterone, increasing rates of cardiovascular disease, and the accumulation of metabolic risk factors all compound the problem. But age itself is more of a risk multiplier than a direct cause. A 60-year-old who exercises regularly, manages his blood pressure, sleeps well, and has low stress can outperform a sedentary, anxious 30-year-old.

Emerging Research on Gut Health

An area of growing scientific interest is the link between gut microbiome composition and erectile function. Research is still in early stages, but the proposed pathway is plausible: an unhealthy gut bacterial balance can promote chronic low-grade inflammation throughout the body, damage the endothelial cells that line blood vessels, disrupt hormone levels, and alter neurotransmitter production, all of which are established contributors to erectile difficulty. This is not yet a basis for treatment recommendations, and no one should be buying a probiotic supplement expecting it to fix their erections. But it is a reminder that erectile health is downstream of whole-body health, and interventions like diet quality and reduced antibiotic overuse may have broader sexual health implications than we currently appreciate.

Peyronie’s Disease and Structural Problems

Peyronie’s disease involves the development of scar tissue (plaque) inside the penis, causing a bend or curvature that can be painful and, in many cases, impair erections. The scar tissue can interfere with the normal expansion and blood-trapping mechanism needed for rigidity. In severe cases, Peyronie’s disease and erectile dysfunction coexist and may require surgical intervention. In one case series, patients with severe Peyronie’s disease and concurrent erectile dysfunction were treated with prosthesis implantation and straightening procedures, achieving a straight penis in the vast majority of cases. If you have noticed a new bend in your penis along with worsening erections, see a urologist. Peyronie’s is more common than most people realize and has effective treatments.