An erection happens when blood fills two spongy chambers inside the penis and gets trapped there under pressure. The process involves your brain, nerves, hormones, and blood vessels all working together in a specific sequence. Understanding how each piece contributes explains not only what makes an erection happen, but also why it sometimes doesn’t.
How an Erection Works, Step by Step
The penis contains two cylinder-shaped chambers called the corpora cavernosa, which run side by side along its length. These chambers are filled with a network of tiny, expandable blood spaces, almost like a sponge. In a non-aroused state, the smooth muscle lining these spaces stays contracted, limiting blood flow and keeping the penis soft.
When arousal starts, nerve signals trigger the release of a chemical called nitric oxide inside the penis. Nitric oxide is the key molecule in the entire process. It sets off a chain reaction: nitric oxide activates an enzyme that produces a second messenger molecule (cGMP), which tells the smooth muscle cells in those spongy chambers to relax. Once the muscle relaxes, the small arteries feeding the penis open wide and blood rushes in.
As blood fills the expanding chambers, they press outward against a tough, fibrous outer shell called the tunica albuginea. This shell doesn’t stretch much, so the expanding tissue compresses the small veins that would normally drain blood out of the penis. The deep vein running along the top of the penis gets squeezed between the swollen tissue and that outer shell, effectively blocking the exit. Blood flows in but can’t flow out, and that’s what creates rigidity.
Two Ways Arousal Starts
Erections can be triggered through two distinct nerve pathways. The first is psychogenic arousal, which originates in the brain. Visual stimulation, sounds, fantasies, or emotional connection send signals down through the spinal cord (specifically the T11 through L2 levels) to the penis. This is the pathway responsible for getting hard from watching something arousing or thinking about a partner.
The second pathway is reflexogenic arousal, which is a direct physical response to touch. Stimulation of the genitals sends signals through a lower part of the spinal cord (S2 through S4) that can produce an erection without any mental arousal at all. This reflex arc is why erections can happen during a medical exam or in situations where a person isn’t mentally turned on. It’s also the mechanism behind nocturnal erections, which occur during REM sleep in every healthy male regardless of age. About 80% of sleep-related erections happen during REM cycles, typically three to five times per night.
In most real-world situations, both pathways work together. Mental arousal opens the door and physical stimulation reinforces it, or vice versa.
The Role of Testosterone
Testosterone doesn’t directly cause erections the way nitric oxide does, but it sets the stage. It fuels sexual desire, and without adequate levels, the brain is less likely to initiate the arousal signals that start the whole cascade. Testosterone also helps maintain the health of the erectile tissue itself.
The American Urological Association defines low testosterone as a total level below 300 ng/dL, measured on at least two separate mornings (testosterone peaks in the early morning and drops throughout the day). Below that threshold, men commonly experience reduced libido and erectile difficulty. But testosterone alone rarely explains erection problems. Plenty of men with levels in the normal range still have issues, and some men with borderline-low levels function fine. It’s one piece of a larger system.
Why Blood Vessel Health Matters So Much
Because erections are fundamentally a blood-flow event, the health of your blood vessels has an outsized impact. The inner lining of blood vessels, called the endothelium, is where nitric oxide gets produced. When that lining is damaged or dysfunctional, it releases less nitric oxide, which means less smooth muscle relaxation, less blood flow, and weaker erections.
This is why erectile difficulty is often an early warning sign of cardiovascular disease. The arteries supplying the penis are smaller than the ones feeding the heart, so they tend to show damage first. The same factors that clog coronary arteries, including high blood pressure, high cholesterol, diabetes, and smoking, also degrade the endothelial lining in penile arteries. Research on endothelial function confirms that smoking, heavy alcohol use, and sedentary lifestyle are among the most significant reversible causes of impaired nitric oxide release.
On the flip side, regular cardiovascular exercise, maintaining a healthy weight, and not smoking are the most effective ways to protect erectile function long-term. These aren’t vague wellness suggestions. They directly preserve the cellular machinery that produces nitric oxide.
What Can Interfere
Erection problems generally fall into two categories: physical (organic) and psychological, though they often overlap. Doctors sometimes use nocturnal erection testing to help tell them apart. If a man still gets firm erections during sleep, the physical plumbing likely works and the issue is more psychological. If nighttime erections are absent or weak, there’s usually something physiological going on.
Physical causes include vascular disease, diabetes (which damages both blood vessels and nerves), low testosterone, nerve injuries from surgery or spinal cord damage, and medications like certain antidepressants or blood pressure drugs. Psychological causes include performance anxiety, stress, depression, and relationship conflict. Anxiety is particularly disruptive because it activates the sympathetic nervous system, which constricts blood vessels and directly opposes the relaxation response needed for an erection.
Age plays a role too, though not in the simple way most people assume. Aging itself doesn’t switch off erectile function, but it gradually reduces nitric oxide production, slows blood vessel repair, and lowers testosterone. The refractory period (the recovery time needed after orgasm before another erection is possible) also lengthens with age, though surprisingly, there’s very little published data quantifying exactly how much it changes decade by decade. A teenager might recover in minutes, while a man in his 50s or 60s might need hours or longer, but the specific timeline varies widely between individuals.
What Keeps an Erection Going
Getting hard and staying hard involve slightly different challenges. The initial rush of blood is driven by arterial dilation, but maintaining the erection depends on that venous trapping mechanism. The tunica albuginea needs to be firm enough, and the internal tissue needs to expand enough, to compress those drainage veins shut. If the outer shell has lost elasticity (which can happen with age or conditions like Peyronie’s disease) or the smooth muscle has been partially replaced by scar tissue, blood leaks out faster than it flows in. This is called venous leak, and it’s a common reason men can get partially hard but can’t maintain full rigidity.
Continued arousal also matters. The brain needs to keep sending signals, and the nerve endings in the penis need to keep releasing nitric oxide. Distractions, anxiety, or losing mental focus can interrupt that signaling. This is why erections can fade during sex even when nothing is physically wrong. The system requires sustained input from both the nervous system and the vascular system working in sync.

