What Makes a Man Get an Erection: How It Works

An erection happens when the brain or spinal cord sends a signal that causes blood vessels in the penis to relax and fill with blood. It’s a chain reaction involving your nervous system, blood vessels, hormones, and a key signaling molecule called nitric oxide. The process can be triggered by physical touch, visual stimulation, fantasy, or even happen spontaneously during sleep.

How the Signal Starts

Erections begin in one of two places: the brain or the lower spinal cord. When you see, hear, or imagine something sexually arousing, your brain processes that stimulus and sends signals down through the spinal cord to nerves that supply the penis. A region deep in the brain called the medial preoptic area acts as a coordination hub, integrating sexual cues and triggering the physical response. Dopamine activity in this area plays a major role: when dopamine signaling there increases, sexual arousal and genital reflexes are enhanced. When it’s blocked, both motivation and physical response drop.

The other pathway bypasses the brain entirely. Direct touch to the penis activates sensory receptors in the skin and glans. Those signals travel through the pudendal nerve to erection centers in the lower spinal cord (at the S2 through S4 segments), which can fire off a response on their own through a reflex arc. This is why erections can happen from physical contact even without conscious arousal, and why men with certain spinal cord injuries above this level can still get reflex erections.

Three Types of Erections

Not all erections start the same way. Psychogenic erections are triggered by mental stimulation: visual cues, sounds, fantasies, or even non-genital touch that your brain interprets as erotic. The signal originates in the cortex and travels down through both the parasympathetic and sympathetic nervous systems.

Reflexogenic erections come from direct genital stimulation. Touch activates local sensory nerves, which loop through the spinal cord and back out to the penis without requiring input from the brain. In a fully rigid erection, both pathways typically work together, with brain signals reinforcing the spinal reflex and vice versa.

Nocturnal erections happen during REM sleep, usually three to five times per night. These are largely automatic and are thought to result from shifts in brain activity during sleep cycles. They serve as a useful indicator of physical function: if a man gets firm nocturnal erections but struggles during sex, the issue is more likely psychological than vascular or neurological.

What Happens Inside the Penis

The penis contains two cylinder-shaped chambers called the corpora cavernosa, made of spongy tissue filled with tiny blood vessels. When you’re not aroused, the smooth muscle lining these chambers stays contracted, limiting blood flow. During arousal, parasympathetic nerves release nitric oxide and acetylcholine directly into this tissue.

Nitric oxide is the critical molecule. Once released by nerve and endothelial cells, it triggers an enzyme that produces a second messenger molecule called cGMP. This cGMP sets off a cascade that forces calcium out of smooth muscle cells and blocks more calcium from entering. With less calcium available, the smooth muscle relaxes. Blood flow into the corpora cavernosa increases several-fold, and the spongy tissue expands as its tiny sinusoids fill.

As the chambers swell, they press outward against a tough fibrous sheath called the tunica albuginea. This compression squeezes the small veins that normally drain blood out of the penis, trapping it inside. The combination of high inflow and restricted outflow is what creates and maintains rigidity. Research on this trapping mechanism shows that the stretching of the tunica narrows and lengthens these tiny veins, dramatically increasing their resistance to blood flow and, in ideal conditions, approaching near-complete occlusion at very low pressure differences.

How an Erection Ends

The erection doesn’t last indefinitely because the body has a built-in off switch. An enzyme called PDE5 breaks down cGMP, the molecule responsible for keeping smooth muscle relaxed. As cGMP levels drop, calcium floods back into the muscle cells, the smooth muscle contracts again, blood flow decreases, and the trapped blood drains out through the veins. This is the same enzyme that erectile dysfunction medications target: they block PDE5, allowing cGMP to accumulate longer and making it easier to maintain the relaxed, blood-filled state.

The sympathetic nervous system also plays a role in ending an erection. While the parasympathetic system drives arousal and blood flow, sympathetic activation promotes contraction of the smooth muscle and return to a flaccid state. This is one reason why stress or anxiety, which ramp up sympathetic activity, can make it harder to get or keep an erection.

The Role of Testosterone

Testosterone doesn’t directly cause erections, but it sets the stage for the entire process. It maintains the health of the smooth muscle and nerve tissue in the penis, supports nitric oxide production, and drives sexual desire, which feeds the psychogenic pathway. Without adequate testosterone, both the desire and the machinery to respond can diminish.

The relationship between testosterone levels and erection quality is well documented. In a study of men aged 40 to 65, those with mild erectile difficulties had average testosterone levels around 433 ng/dL, while men with moderate issues averaged 362 ng/dL and those with severe problems averaged about 279 ng/dL. Roughly 10 to 40% of men with erectile dysfunction have low testosterone, depending on age and other health conditions. Testosterone doesn’t work in isolation, though. A man with healthy testosterone levels can still have erectile problems if his blood vessels or nerves are compromised.

Why Blood Vessel Health Matters

Because erections depend entirely on blood flow, the health of your blood vessel lining (the endothelium) is directly linked to erectile function. The endothelium produces much of the nitric oxide that drives the process. Conditions that damage blood vessels, including high blood pressure, diabetes, high cholesterol, obesity, and smoking, impair nitric oxide production and reduce the ability of vessels to dilate. One study found that erection firmness specifically correlated with endothelial function measurements, and that men over 63 had significantly lower endothelial function scores than younger men.

This connection runs both ways. Erectile difficulty is often an early warning sign of cardiovascular disease because the small arteries in the penis are narrower than coronary arteries and show damage sooner. Problems getting an erection can precede heart disease symptoms by two to five years.

How Erections Change With Age

Erection quality shifts gradually over a man’s lifetime, and the changes start earlier than most people expect. The refractory period, the time needed between one erection and the next, begins increasing for most men sometime in their 20s. This is one of the earliest signs of the slow, natural loss of smooth muscle tissue in the penis through a process called apoptosis (programmed cell death).

Data from the Massachusetts Male Aging Study puts specific numbers on this progression: about 40% of men in their 40s experience some degree of erectile difficulty, and the prevalence rises roughly 10% per decade. By the 50s, it’s about 50%. By the 60s, about 60%. The underlying mechanism is a gradual loss of the smooth muscle that needs to relax for blood to fill the chambers. As that tissue is replaced with less elastic collagen, it takes more stimulation to achieve the same result, erections may be less firm, and they may not last as long. None of this means erections stop entirely. It means the process requires more direct stimulation, more time, and better overall health to work optimally.