By 1926, the year he died, Harry Houdini had made an elephant disappear, walked out of a brick wall assistants had built around him, regurgitated needles and blades, swam out of a nailed-shut box into which he'd been shackled and thrown into the East River, and escaped countless handcuffs and straitjackets (often while hanging upside-down).

The magician’s seemingly never-ending tricks were usually sleight-of-hand, the result of hidden features in his props, or exploitations of the weaknesses of his restraints. But for arguably his greatest trick, one he performed at the age of 52 just months before he died, Houdini had to master his own physiology.

In July of that year, magician Rahman Bey performed a stunt that rivaled any of Houdini’s. Bey was enclosed in a metal box, which was submerged in a swimming pool in New York’s Dalton Hotel. After an hour, assistants pulled him out, alive. Bey directly challenged Houdini to replicate the stunt.

According to Harry Houdini: Death-Defying Showman by Rita Thievon Mullin, Houdini practiced for weeks to regulate his breathing, taking shallow breaths in the hopes of conserving oxygen within an airtight container. His assistants built a glass case, one that would allow Houdini to give a visual cue if he was about suffocate. On the first practice run, he spent one hour and 10 minutes in it, emerging sweaty and gasping. He feared, however, that some air may have seeped in, so he made a second practice attempt. This time, the glass case was lowered into a pool of water. Once again, Houdini managed 70 minutes before giving the signal to be let out.

On August 5, 1926, Houdini performed the stunt in front of journalists at the Hotel Shelton in New York. He entered a metal casket, which his assistants lowered into a swimming pool. Houdini’s reputation was at stake, but he made an effort to ensure that his life wasn’t. According to Mullin, the casket was wired with a buzzer he could press in case he felt imminent death. There was also a telephone line within the device. Houdini’s assistant, James Collins, called down every few minutes to inform him how much time had passed.

Peter M. Lalley, emeritus professor of physiology at the University of Wisconsin-Madison, told mental_floss he wouldn’t recommend trying this at home. “You’re not very long for survival in an enclosed space,” he says. Normal air is about 20 percent oxygen. Once “used” by animals breathing, that percentage goes down until there is nothing beneficial to bind to the body’s hemoglobin. There are ways to slow down the depletion, however: Taking shallower breaths helps, Lalley says, and swimmers and divers often hyperventilate before a task to lower the body’s carbon dioxide levels.

Back at the pool in 1926, Houdini chose to stay in after Collins called and told him he had exceeded Bey’s timing. He finally buzzed to be let loose after 91 minutes.

Houdini had consulted with Dr. W. J. McConnell, a former surgeon at the U.S. Bureau of Mines, who researched survival techniques for trapped miners. McConnell was present at the August 5 stunt, and a few hours after freeing himself Houdini typed him a detailed letter, outlining his experiences—including what he’d had for breakfast that morning (“a fruit salad and half a cup of coffee”)—in the hopes they’d be of use to McConnell.

“After one hour and twenty-eight minutes, I commenced to see yellow lights and carefully watched myself not to go to sleep,” the magician wrote. “I kept my eyes wide open. Moved on the broad of my back, so as to not take all the weight off my lungs, my left arm was across my chest. I laid on my right side, my left buttock against the coffin so that I could keep the telephone receiver against my ear without holding it.”

However, Houdini didn’t always know the limits of his body and may have died accomplishing a much less impressive feat. Three months later, he succumbed to complications from a ruptured appendix—the result, according to legend, of a Montreal college student testing Houdini’s boast that he could take a punch in the gut with no ill effect.