Your penis gets hard because blood fills two sponge-like chambers inside it faster than it can drain out. This happens through a precise chain of signals: your nervous system releases a chemical messenger that relaxes the muscles inside the penis, arteries open wide, blood rushes in, and the expanding tissue compresses the veins that would normally let blood flow back out. The result is a pressurized, rigid organ. The whole process depends on your brain, nerves, hormones, and blood vessels all working together.
What Triggers the Process
Erections start with your nervous system. The parasympathetic nervous system, the branch responsible for “rest and digest” functions, is the main driver. During arousal, excitatory signals can originate in the brain from visual stimulation, fantasy, or physical touch to the genitals. The sympathetic nervous system, by contrast, tends to inhibit erections. That’s why stress, anxiety, or a sudden fright can kill an erection almost instantly: the sympathetic system is overriding the parasympathetic one.
Not all erections require the brain’s involvement. Some are generated entirely by the spinal cord. Evidence for these “reflexive” erections comes from observations of soldiers with spinal cord injuries during World War II, who could still get erections from direct touch even though the connection between their brain and lower body was severed. This is also how nocturnal erections work during sleep: your body cycles through them several times a night without any conscious arousal.
The Chemical Chain Reaction
Once the nervous system sends its signal, nerve endings and blood vessel walls inside the penis release a gas called nitric oxide. This is the key molecule. Nitric oxide triggers an enzyme that produces a second messenger molecule called cGMP, which acts like a “relax” command for the smooth muscle cells lining the penile arteries and the spongy chambers inside the shaft. Those muscle cells unclench, the arteries dilate, and blood pours in.
The process is fast because the muscle cells in the penis are in a partially contracted state most of the time. Your penis is actively kept soft by ongoing muscle tension. An erection isn’t your body adding something new; it’s your body releasing a brake.
How Blood Gets Trapped Inside
The penis contains two cylindrical chambers called the corpora cavernosa, which run side by side along most of its length. These chambers are filled with a mesh of expandable tissue, like a sponge. When blood floods in, the tissue swells dramatically.
Wrapped around each chamber is a tough, fibrous sheath made mostly of collagen and elastic fibers. This outer layer doesn’t contain muscle; it’s a passive covering that stretches only so far. As the spongy tissue inside expands, it presses outward against this sheath, and the expanding tissue compresses the small veins that normally drain blood out of the penis. Those veins get squeezed shut between the swelling inner tissue and the rigid outer sheath. Blood flows in but can’t flow out, and internal pressure builds. In humans, this pressure typically rises to match or exceed systemic blood pressure, which is what makes the penis rigid enough for penetration.
Internal support structures, small pillars of tissue that radiate inward from the outer sheath, help distribute this pressure evenly and prevent the chambers from ballooning unevenly.
How Testosterone Fits In
Testosterone doesn’t directly cause individual erections, but it sets the stage for them. The hormone maintains the machinery that makes erections possible. When testosterone levels drop, the body produces less nitric oxide synthase, the enzyme responsible for making nitric oxide in penile tissue. Less nitric oxide means weaker relaxation signals and less blood flow.
Low testosterone also causes structural changes. The nerves supplying the penis can atrophy, and the smooth muscle tissue can be partially replaced by less flexible collagen. These changes are reversible with hormone supplementation in many cases, which is why men with low testosterone who don’t respond well to erection medications often see improvement once their hormone levels are restored. Testosterone essentially keeps the penile tissue healthy, responsive, and well-supplied with nerves.
How an Erection Ends
An erection doesn’t just fade on its own. Your body actively dismantles it. An enzyme called PDE5 breaks down cGMP, the molecule that was keeping the smooth muscle relaxed. Once cGMP levels drop, the smooth muscle cells contract again, the arteries narrow, blood flow slows, and the compressed veins reopen to let blood drain. The penis returns to its soft state within minutes.
This is exactly the mechanism that common erection medications target. They block PDE5 from doing its job, which means cGMP stays active longer, the muscles stay relaxed, and blood stays trapped in the chambers. The medications don’t create arousal or force an erection; they just make the natural process more effective once it starts.
Why Erections Change With Age
Erectile function declines gradually for most men, and the statistics are more common than many people realize. About 22% of men experience moderate to complete erectile difficulty by age 40. By age 70, that number rises to 49%. When you include milder changes, like erections that are less firm or take longer to develop, roughly 39% of 40-year-olds and 67% of 70-year-olds report some degree of change, based on data from the Massachusetts Male Aging Study.
The reasons are cumulative. Blood vessels stiffen with age, reducing the surge of blood flow that makes erections firm. Testosterone levels decline about 1% per year after age 30. The smooth muscle tissue in the penis gradually gets replaced by less elastic fibers. Conditions that damage blood vessels, like high blood pressure, diabetes, and high cholesterol, accelerate the process. Smoking is particularly damaging because it impairs the nitric oxide pathway directly.
These changes don’t happen overnight, and they don’t affect every man equally. Cardiovascular fitness is one of the strongest predictors of erectile health at any age, because the entire mechanism depends on healthy blood flow and responsive blood vessels. In fact, new erectile difficulty in a younger man is sometimes the first visible sign of cardiovascular problems developing elsewhere in the body.
Types of Erections
Your body produces erections in three distinct ways, each using a slightly different neural pathway. Psychogenic erections come from mental stimulation: visual cues, imagination, or emotional arousal. These signals travel from the brain down the spinal cord to the penis. Reflexogenic erections come from direct physical touch to the genitals, processed through a reflex arc in the lower spinal cord without needing brain involvement. Nocturnal erections happen during REM sleep, typically three to five times per night, and are thought to be related to shifts in nervous system activity during sleep cycles.
The existence of these separate pathways explains why some men can get erections in one context but not another. A man who gets firm nocturnal erections but struggles during sex likely has a psychological or situational barrier rather than a physical one, since the hardware is clearly working. Conversely, a man who loses nocturnal erections may have a vascular or nerve issue worth investigating.

