What Causes an Erection and How It Works

An erection happens when blood fills two sponge-like chambers inside the penis and gets trapped there under pressure. The process is a coordinated chain reaction involving your brain, nerves, blood vessels, hormones, and smooth muscle tissue, all working together in a sequence that takes just seconds to begin.

How the Signal Starts

Erections begin with a signal from the nervous system, but that signal can originate in two very different ways. A psychogenic erection starts in the brain, triggered by something you see, hear, imagine, or remember. Those signals travel down the spinal cord to erection centers located in the lower back and sacral spine. A reflexogenic erection, on the other hand, starts with direct physical touch to the genitals. Those sensory impulses travel to the sacral spinal cord (at the S2 through S4 segments), where they activate the response locally, sometimes without any conscious thought at all.

In most real-world situations, both pathways work together. The brain modulates the spinal erection centers while physical sensation reinforces the signal from below. From these spinal centers, the parasympathetic nervous system sends impulses through a set of nerves called the cavernous nerves, which run from the pelvic plexus directly to the penis. Stimulating these nerves initiates erection, while activity in the opposing sympathetic nervous system ends it.

The Chemical Chain Reaction

Once the cavernous nerves fire, the nerve endings and the lining of blood vessels in the penis release a gas molecule called nitric oxide. This is the key chemical trigger. Nitric oxide sets off a cascade: it causes cells in the penile tissue to produce a second messenger molecule (cyclic GMP, or cGMP), which acts as the direct instruction for the smooth muscle surrounding the blood vessels and spongy chambers to relax.

When that smooth muscle relaxes, the small arteries feeding the penis dilate rapidly. In studies of healthy young men, the diameter of penile arteries increased by an average of 72%, and blood flow velocity jumped by roughly 200% compared to the flaccid state. Blood rushes into the two main erectile chambers, called the corpora cavernosa, filling millions of tiny interconnected spaces that work like a sponge.

How Blood Gets Trapped

Filling the chambers with blood is only half the equation. For an erection to become rigid, the blood has to stay there. This is where a tough, fibrous sheath called the tunica albuginea plays its essential role. As the spongy tissue inside the corpora cavernosa expands with incoming blood, it presses outward against this sheath. The expanding tissue compresses the small veins that would normally drain blood out of the penis, pinching them shut against the inner wall of the tunica. This trapping mechanism is called veno-occlusion.

The outer layer of the tunica albuginea is particularly critical. Research on cadaveric tissue has confirmed that this outer layer is what fulfills the veno-occlusive function, essentially sealing the system so pressure can build. Internal pressure during a full erection can exceed systolic blood pressure, sometimes reaching well above 100 mmHg during peak rigidity. At those pressures, the penis becomes fully rigid rather than just swollen.

The Role of Testosterone

Testosterone doesn’t directly cause an erection, but it keeps the entire system capable of producing one. Normal testosterone levels increase the expression of the enzymes that produce nitric oxide in penile tissue. At the same time, testosterone suppresses the enzyme (PDE5) that breaks down cGMP, the molecule responsible for keeping smooth muscle relaxed. So testosterone works on both sides of the equation: it helps produce the “go” signal and dampens the “stop” signal.

When testosterone drops significantly, nitric oxide production falls and the breakdown enzyme becomes more active, making erections harder to achieve and maintain. This is one reason why low testosterone is linked to erectile difficulty, even though the hormone itself isn’t what triggers the moment-to-moment response.

How an Erection Ends

The body has a built-in off switch. The enzyme PDE5, which is concentrated in penile tissue, continuously breaks down cGMP into an inactive form. During arousal, nitric oxide production outpaces PDE5 activity, so cGMP levels stay high and the erection holds. Once sexual stimulation stops or after orgasm, nitric oxide release slows and PDE5 gains the upper hand. cGMP levels drop, smooth muscle contracts again, the arteries narrow, the veins reopen, and blood drains out. The sympathetic nervous system actively drives this process of detumescence.

This is also how common erectile dysfunction medications work. They block PDE5 from doing its job, allowing cGMP to accumulate more easily in penile tissue. They don’t create arousal on their own; they simply make the natural chemical cascade more effective once it starts.

Erections During Sleep

Healthy men typically experience several erections during sleep, mostly during REM (rapid eye movement) phases. About 80% of these nocturnal erections occur during REM sleep, following a cyclical pattern that repeats roughly every 80 minutes and lasts about 20 minutes each time. Over a typical night, that adds up to three to five erection episodes.

These aren’t caused by sexual dreams. They appear to be a maintenance function of the nervous system, testing the erectile pathway during the sleep state when the parasympathetic system is most active. The presence or absence of nocturnal erections is sometimes used clinically to help distinguish between physical and psychological causes of erectile difficulty: if the hardware works fine during sleep, the waking problem is more likely rooted in anxiety, stress, or other psychological factors.

How Aging Affects the Process

With age, the lining of blood vessels throughout the body (the endothelium) gradually becomes less efficient at producing nitric oxide. This decline is central to both cardiovascular disease and erectile dysfunction, which is why the two conditions share so many risk factors: high blood pressure, diabetes, smoking, high cholesterol, and sedentary lifestyle all damage the endothelium.

Aging also brings structural changes to penile arteries, reduced elasticity of the tunica albuginea, and a gradual decline in circulating testosterone. Together, these shifts mean the chemical cascade still works but requires more stimulation to get going, produces a weaker response, and resolves more quickly. None of this is inevitable at a specific age, though. Vascular health is the single biggest predictor, and the factors that protect your heart protect erectile function as well.