An erection happens when blood rapidly fills two spongy chambers inside the penis and gets trapped there under pressure. The process is driven by your nervous system, triggered by either physical touch or mental arousal, and depends on a chain of chemical signals that relax muscle tissue and open up blood flow. It sounds simple, but the mechanics involve a surprisingly precise coordination between your brain, nerves, blood vessels, and hormones.
What Happens Inside the Penis
The penis contains three cylindrical structures. Two of them, running side by side along the top, are the main erectile chambers. These chambers are filled with a network of tiny blood-filled spaces, almost like a sponge, woven together with smooth muscle and connective tissue. Wrapped around the outside is a tough, layered sheath of collagen that plays a critical role in maintaining rigidity.
When you’re not aroused, the smooth muscle inside these chambers stays contracted. This contracted state is actively maintained by your sympathetic nervous system, the same branch responsible for your fight-or-flight response. It keeps the muscle tight by continuously releasing norepinephrine (the same chemical behind adrenaline surges), which squeezes the blood vessels and internal tissue so only a small amount of blood flows through. The penis stays soft because that’s its active default state, not a passive one.
The Chemical Chain Reaction
Arousal flips a switch. Your parasympathetic nervous system, the branch that handles rest and recovery, overrides the sympathetic tone keeping everything contracted. Nerves inside the penis release nitric oxide, a gas that acts as the key chemical messenger. Nitric oxide triggers the production of a second messenger molecule called cGMP inside the smooth muscle cells. This molecule is what actually tells the muscle to relax.
Once the smooth muscle relaxes, the small arteries feeding the erectile chambers open wide and blood rushes in. The spongy spaces inside expand like a balloon filling with water. As they swell, they press outward against that tough collagen sheath, and here’s the clever part: the tiny veins that normally drain blood out of the penis run between the expanding tissue and the outer sheath. As the chambers fill and stretch, those drainage veins get physically compressed and pinched shut. Blood flows in but can’t flow out. That trapped blood under pressure is what creates rigidity.
This trapping mechanism is sometimes called the veno-occlusive process, and it’s essential. Even strong arterial blood flow won’t produce a firm erection if the veins aren’t properly compressed. Healthy blood flow into the penis requires a peak velocity of at least 30 centimeters per second through the penile arteries to achieve adequate filling.
Two Pathways to the Same Result
Not all erections start the same way. There are two distinct types, and they use different nerve pathways in the spinal cord.
Psychogenic erections come from your brain. Visual stimulation, fantasies, sounds, or emotional arousal send signals down from the brain through nerves exiting the upper lumbar spine. These are the erections triggered by attraction, anticipation, or imagination, with no physical contact needed.
Reflexogenic erections are triggered by direct physical stimulation of the genitals. The signals travel through a shorter loop in the lower sacral spine and can occur even without conscious arousal. This is why erections can happen during a medical exam or from friction against clothing. It’s a reflex arc, similar in principle to your knee jerking when tapped.
Both pathways converge on the same endpoint: the release of nitric oxide and acetylcholine in the erectile tissue, which kicks off the blood-trapping process described above. In practice, most erections involve some combination of both pathways working together.
Why Erections Happen During Sleep
Nocturnal erections, sometimes called morning wood, occur during REM sleep cycles. Most men experience three to five erections per night, each lasting roughly 25 to 35 minutes. These aren’t caused by sexual dreams. They appear to be a maintenance function, periodically oxygenating the erectile tissue by flooding it with fresh blood. The parasympathetic nervous system is more active during REM sleep while sympathetic activity drops, creating the conditions for erections to occur automatically.
What Makes an Erection Go Away
The sympathetic nervous system reasserts control to end an erection. Norepinephrine is released again, contracting the smooth muscle, squeezing blood out of the chambers, and reopening the drainage veins. The enzyme that breaks down cGMP also ramps up, removing the chemical signal that was keeping the muscle relaxed. The whole process reverses in a matter of minutes.
After ejaculation, the body enters a refractory period where another erection is temporarily difficult or impossible. The exact mechanism isn’t fully understood, but several hormonal shifts contribute. Prolactin surges during orgasm and may directly inhibit the erection process until levels drop back down. Dopamine, which helps drive arousal and ejaculation, appears to temporarily desensitize the penile nerves after orgasm. Serotonin rises as well, promoting relaxation and drowsiness. The refractory period varies enormously between individuals and tends to lengthen with age, ranging from minutes in younger men to hours or longer in older men.
Why Stress and Anxiety Kill Erections
Because the sympathetic nervous system actively prevents erections, anything that activates your stress response works directly against the process. Performance anxiety, work stress, relationship tension, or even being startled can trigger a norepinephrine release that contracts the smooth muscle and overrides arousal signals. This isn’t a psychological weakness. It’s basic physiology: the same chemical that prepares your body for danger is the one that keeps your penis flaccid. Your body is essentially choosing between “deal with threat” and “have sex,” and threat wins every time.
This is also why erections can be unpredictable in high-pressure moments even when desire is clearly present. The brain’s arousal signals and the stress response are competing for control of the same smooth muscle tissue.
How Blood Vessel Health Affects Erections
Because erections depend entirely on blood flow, anything that damages your cardiovascular system will eventually affect erection quality. The arteries feeding the penis are relatively small, typically 1 to 2 millimeters in diameter, which makes them among the first blood vessels to show signs of damage from high blood pressure, high cholesterol, or diabetes. This is why erectile difficulty is sometimes an early warning sign of cardiovascular disease, appearing years before problems show up in larger arteries.
The inner lining of blood vessels produces nitric oxide, the same molecule that triggers erections. When that lining is damaged by smoking, poor diet, or sedentary habits, nitric oxide production drops and the chemical chain reaction that relaxes smooth muscle becomes weaker.
Aerobic exercise directly counters this. Regular cardio improves the health of blood vessel linings and increases nitric oxide production throughout the body, including in erectile tissue. A meta-analysis of randomized controlled trials published in The Journal of Sexual Medicine found that aerobic exercise produced significant improvements in erectile function scores, with the largest gains in men who had the most difficulty at the start. Men with severe erectile dysfunction saw nearly twice the improvement compared to men with mild issues. The mechanism is straightforward: healthier blood vessels mean stronger, more reliable blood flow to the penis.