What Causes a Boner? How Erections Actually Work

An erection happens when blood fills two sponge-like chambers inside the penis and gets trapped there under pressure. The process involves your brain, nervous system, blood vessels, and a chain of chemical signals that all have to work together in the right sequence. It sounds simple, but the mechanics behind it are surprisingly complex.

How Blood Creates an Erection

The penis contains two cylindrical chambers called the corpora cavernosa that run along its length. In a flaccid state, these chambers hold only a small amount of blood at low pressure. When an erection begins, arteries feeding into the penis dilate and blood rushes into the corpora cavernosa, expanding them like a sponge filling with water.

Here’s the key part: as these chambers swell, they physically compress the veins that would normally drain blood away. This trapping mechanism is what maintains rigidity. Blood keeps flowing in but can’t easily flow out, and internal pressure climbs from single digits up to 90 mmHg or higher during full rigidity. The whole structure is wrapped in a tough, fibrous sheath that keeps everything contained under pressure, much like the outer wall of a tire.

The Chemical Chain Reaction

The dilation of those arteries doesn’t happen on its own. It requires a specific chemical sequence. Nerve endings and cells lining the blood vessels inside the penis release a signaling molecule called nitric oxide. This triggers the production of a second messenger molecule (cGMP) that tells the smooth muscle cells wrapped around the blood vessels to relax. When those muscles relax, the vessels open wide and blood pours in.

This is also how the erection ends. An enzyme called PDE5 naturally breaks down cGMP over time. As cGMP levels drop, the smooth muscle contracts again, blood vessels narrow, the trapped blood drains out, and the penis returns to its flaccid state. Common erectile dysfunction medications work by blocking PDE5, which keeps cGMP levels elevated longer and makes it easier to maintain an erection.

What Triggers the Process

Not all erections start the same way. There are two main types, and they originate from different parts of the nervous system.

  • Psychogenic erections start in the brain. Visual stimuli, sounds, fantasies, or memories of arousal send signals down through the spinal cord (from the thoracic and lumbar levels, roughly mid-back) to the penis. These are the erections triggered by seeing or thinking about something arousing.
  • Reflexogenic erections bypass the brain entirely. Direct physical touch to the genitals sends signals to the lower spinal cord (the sacral region, near the tailbone), which fires back a response without any input from higher brain centers. This is why erections can happen from friction or pressure even without any mental arousal.

Both types activate the parasympathetic nervous system, which is the branch responsible for “rest and digest” functions. It’s the parasympathetic signals that cause the blood vessels to dilate. The sympathetic nervous system, its counterpart, does the opposite: it constricts blood vessels and causes the erection to subside. This is one reason why stress, anxiety, or a sudden adrenaline surge can kill an erection quickly.

The Brain’s Role in Arousal

For psychogenic erections, the brain does a lot of processing before any signal reaches the penis. When you encounter something sexually stimulating, a wide network of brain regions activates. Areas involved in emotion, memory, and reward all contribute. Dopamine plays a central role here, driving sexual motivation and the sense of wanting. It’s the same neurotransmitter involved in other reward-driven behaviors, which helps explain why anticipation and novelty can be such strong triggers for arousal.

Other chemical systems in the brain contribute too, including serotonin, norepinephrine, and acetylcholine. The balance between these signals matters. Dopamine generally promotes arousal, while serotonin can suppress it, which is why certain antidepressants that raise serotonin levels often cause sexual side effects.

Erections During Sleep

Healthy males typically get erections throughout the night during REM sleep, the phase associated with dreaming. These episodes follow a cyclical pattern, repeating roughly every 80 minutes and lasting about 20 minutes each. Around 80% of these nighttime erections coincide with REM periods. They aren’t necessarily linked to sexual dreams. The current understanding is that they’re a byproduct of the nervous system cycling through different states during sleep, with parasympathetic activity naturally dominating during REM.

These nighttime erections are actually clinically useful. If someone has erectile difficulties while awake but still gets firm erections during sleep, it suggests the plumbing and nerve pathways are working fine and the issue is more likely psychological or situational.

Why Testosterone Matters

Testosterone doesn’t directly cause erections the way nitric oxide does, but it sets the stage. It influences sex drive, supports the health of erectile tissue, and helps maintain the chemical pathways that make erections possible. The American Urological Association defines low testosterone as a total level below 300 ng/dL, and erectile dysfunction is recognized as a common symptom of that deficiency.

The relationship isn’t perfectly linear, though. Some men with levels above 300 still experience problems, while others with lower levels function fine. Testosterone is more like a baseline requirement than a direct trigger. Once levels are adequate, having more doesn’t necessarily mean stronger or more frequent erections.

Common Reasons Erections Happen Unexpectedly

Random erections, especially during puberty and young adulthood, are normal and don’t always have an obvious cause. Hormonal fluctuations, light physical contact, vibrations (like riding in a car), or even a full bladder pressing on pelvic nerves can trigger a reflexogenic response. The nervous system is simply doing what it’s designed to do, and sometimes the threshold for activation is low.

Morning erections are typically the tail end of the last REM-associated erection of the night. Waking up during or just after a REM cycle means you catch it before the sympathetic nervous system fully ramps up for the day and shuts it down. They’re generally a sign that your vascular and neurological systems are healthy, not that you were having a sexual dream.