WHEN FORMER Google executive Alan Eustace dove more than 135,000 feet through the air, it was the culmination of three years of work: parachute and balloon design, test falls from 57,000 and 105,000 feet up, and flight simulations. On October 24, 2014, Eustace donned a custom high-pressure spacesuit and strapped himself into a helium balloon. He focused on his breath as he made his ascent, and calmed his nerves by thinking of his practice runs. Then he made skydiving history. The plunge from the stratosphere was 1.5 miles longer than the previous record, making Eustace the current record holder for the highest-altitude free-fall jump.

Few would have the stomach to drop at speeds hitting 822 mph from the top of Earth’s ozone layer with nothing but a parachute on their back. If you have an extreme fear of heights, just the thought may be enough to make your legs feel like jelly. But, as Eustace’s preparation showed, there are ways to gird yourself physically and mentally for that dread.

Dreading lofty elevations is a universal feeling—even daredevils occasionally get uneasy in such settings. Elizabeth McMahon, a San Francisco–based psychologist specializing in treating phobias, says Homo sapiens evolved this way to avoid perils from an early age. In a 1960 experiment, psychologists placed crawling babies on a table with a clear plastic panel at the end, which they called a “visual cliff.” The extension gave the illusion the infants would fall if they tried to reach for their mothers on the other side. Almost all of the subjects refused to crawl over the plastic.

A fear of heights, which in extreme cases is called acrophobia, most likely helped our ancestors avoid falling from life-threatening ledges, according to McMahon. The apprehension is hard-wired into human brains. When you are faced with a long drop, there is a strong response in the amygdala, a primordial brain structure. This almond-shaped region activates additional parts of the limbic system like the hypothalamus, which triggers the fight-flight-or-freeze response by signaling glands to release adrenaline and cortisol. The hormones act as a distress call to the body, causing physical changes like increased blood pressure, breathing rate, and heart rate.

Because these areas are so highly stimulated at the sight of a potential threat, brain activity elsewhere is dampened. One important area in particular becomes impaired: the more recently evolved cerebral cortex, which is involved in logic and reasoning. This makes it harder to think and make rational decisions, McMahon says.

Understanding what’s causing you to feel lightheaded and anxious is the first step toward overcoming a fear of heights. The next is to practice relaxation techniques such as deep-breathing or mindfulness exercises when doing an activity far off the ground. The first sends oxygen to the brain, indicating that you’re not in danger. The reassuring effect then activates the parasympathetic nervous system, which relaxes your muscles and instills widespread feelings of calm.

The final step is slowly exposing yourself to the source of trepidation. A psychologist specializing in phobias can use a technique called exposure therapy to help you teach your brain that heights aren’t a guaranteed death sentence. This research-based method brings you in repeated contact with the source of your fear, and your therapist will teach you how to manage your anxiety as you gradually encounter greater increases in elevation. McMahon also recommends combining exposure therapy with virtual reality programs, where you can start with something as small as simulated walks up a 20-floor staircase and eventually work toward more extreme scenarios, like being perched on top of a skyscraper.

“In my experience, five to eight virtual reality sessions have often helped people get over their fear of heights,” McMahon says. “They don’t even have to travel to the Grand Canyon.”

This story originally appeared in the High Issue of Popular Science. Read more PopSci+ stories.