An erection happens when blood fills two sponge-like chambers inside the penis and gets trapped there under pressure. The process involves your brain, spinal cord, blood vessels, hormones, and a specific chemical chain reaction that relaxes muscle tissue. It sounds simple, but the coordination required is surprisingly complex, which is why so many different factors can disrupt it.
The Chemical Chain Reaction
The key player is nitric oxide, a gas your body produces in tiny amounts at the right moment. When you become aroused, nerve endings in the penis release nitric oxide from an amino acid called l-arginine. This nitric oxide enters the smooth muscle cells lining the blood vessels and spongy tissue of the penis, where it triggers production of a second messenger molecule called cyclic GMP (cGMP).
Cyclic GMP is what actually does the work. It causes the smooth muscle in the penis to relax, which widens the arteries and allows a rush of blood into the two cylindrical chambers called the corpora cavernosa. These chambers run the length of the penis and are made of expandable tissue that fills like a balloon. As they swell, the outer sheath of the penis (a tough, fibrous layer) stretches and compresses the veins that would normally drain blood away. This trapping mechanism is what creates and maintains rigidity. In a healthy erection, the internal pressure reaches over 60 mm Hg, enough to produce full firmness.
About 80% of men with vascular-related erectile problems have a failure in this blood-trapping step specifically. Either the veins don’t compress properly, the sheath has lost elasticity, or the smooth muscle tissue itself has changed structurally.
Three Types of Erections
Not all erections start the same way. Your body can trigger one through at least three distinct pathways.
Psychogenic erections start in the brain. Visual input, sound, memory, or fantasy sends signals down the spinal cord through nerve pathways at the mid-to-lower back level (T11 through L2). These signals initiate the nitric oxide release described above. This is the type most people think of: you see or imagine something arousing, and your body responds.
Reflexogenic erections bypass the brain entirely. Direct physical touch to the genitals sends a signal to the lower spinal cord (S2 through S4), which triggers an erection through a local reflex arc. This is why erections can occur even during non-sexual medical exams or in men with certain spinal cord injuries where the brain’s connection to the lower body is severed.
Nocturnal erections happen during sleep, typically during REM phases. A healthy male experiences four or five erections per night, each lasting roughly 25 minutes on average, cycling about every 85 minutes. These aren’t caused by sexual dreams. They appear to be a maintenance function of the nervous system, and their presence or absence is sometimes used clinically to distinguish psychological from physical causes of erectile difficulty.
What Testosterone Actually Does
Testosterone’s role is less direct than most people assume. It clearly drives libido, the desire for sex, which makes psychogenic erections more likely. But its contribution to the physical mechanics of erection is subtler. Animal studies show that low testosterone reduces nitric oxide production in penile tissue by roughly 45%, and that restoring testosterone levels prevents this drop. So testosterone appears to keep the chemical machinery primed, even if it isn’t pulling the trigger in the moment.
Low testosterone (defined clinically as below 300 ng/dL with symptoms present) is associated with fatigue, reduced muscle mass, increased abdominal fat, and decreased sexual desire. All of these can contribute to erectile problems indirectly. This is why testosterone is measured as part of any standard evaluation for erectile dysfunction, though simply having normal testosterone levels doesn’t guarantee normal erections.
How an Erection Ends
The erection doesn’t just fade passively. An enzyme called phosphodiesterase type 5 (PDE5) actively breaks down cyclic GMP in the penile tissue. As cGMP levels drop, the smooth muscle contracts again, blood flow slows, the veins reopen, and blood drains out. The penis returns to its soft state.
This enzyme is the target of medications like sildenafil. These drugs don’t create erections on their own. They block PDE5 from breaking down cGMP so quickly, which means the erection lasts longer once arousal has already started the process. Without that initial nitric oxide release from arousal, the medication has nothing to amplify.
When PDE5 is underactive or dysregulated, the opposite problem can occur: erections that won’t go away, a painful condition called priapism. Research in mice has shown that disrupting PDE5 function leads to unrestrained smooth muscle relaxation after stimulation, essentially an erection with no off switch.
What Helps and Hurts the Process
Because nitric oxide production is the bottleneck of the entire erection process, anything that supports or undermines it has a measurable effect.
On the positive side, dietary nitrate (found in beets, leafy greens, and other vegetables) enhances the body’s ability to produce nitric oxide through an alternative pathway that depends on bacteria in your mouth converting nitrate to nitrite. Regular exercise also supports nitric oxide production by improving the health of blood vessel linings.
Several common factors work against this system. Smoking directly impairs nitric oxide production. Chronic use of proton pump inhibitors (a common type of heartburn medication) has also been linked to reduced production. High intake of high-fructose corn syrup appears to interfere as well. One surprising finding: antibacterial mouthwash kills the oral bacteria responsible for converting dietary nitrate into a usable form, which can measurably reduce nitric oxide levels. Even certain vegetables in the cabbage family, when consumed alongside nitrate-rich foods, may impair the conversion process.
Cardiovascular health matters enormously. The arteries supplying the penis are smaller than those feeding the heart, so they tend to show the effects of arterial damage earlier. Conditions like high blood pressure, diabetes, and high cholesterol all damage the endothelial cells that line blood vessels and produce nitric oxide. This is why erectile difficulty is sometimes an early warning sign of broader cardiovascular disease, appearing years before a heart attack or stroke would.
The Role of the Nervous System
Even with perfect blood flow and hormone levels, erections require intact nerve signaling. The nerves responsible aren’t part of the voluntary nervous system you use to move your muscles. They belong to the autonomic system, specifically parasympathetic nerves that release nitric oxide directly (sometimes called nitrergic nerves). Damage to these nerves from surgery, diabetes, or spinal injury can prevent the signal from reaching the penile tissue at all.
Psychological factors like stress, anxiety, and depression affect the brain’s ability to initiate the psychogenic pathway. Performance anxiety creates a particularly frustrating loop: worry activates the sympathetic (fight-or-flight) nervous system, which constricts blood vessels and directly opposes the parasympathetic signals needed for erection. The mechanics are intact, but the brain is sending competing instructions.

