Researchers in England have found that laughter can help boost pain tolerance.

In the study, participants watched 15 minutes of a comedy like The Simpsons after being subjected to mild forms of pain—tightening a blood pressure cup, or applying a freezing wine cooler sleeve to their arm.

People who had laughed heartily at the comedy could take up to 10 percent more pain than people watching less-funny programming. What is laughter’s secret?

“You breathe in and then breathe out repeatedly while laughing until you are almost out of breath,” Vurgt says. The physical intensity of laughter—like a good massage or a jog—triggers the brain to release endorphins, the feel-good neurotransmitters that can help alleviate pain. This finding supports previous research that showed post-surgery patients exposed to humorous material made fewer requests for pain medications.

In another twist on the study, researchers showed clips from romantic movies to the participants, but their pain tolerance didn’t increase. Only when they laughed did the pain-dampening effect kick in—meaning it’s belly laughter, and not just a good mood, that does the trick.

It might help, however, if you invite over a few friends: People laughed 30 more times on average when in a group than when alone. “Laughter is highly contagious,” Vurgt says, “so being in a group and laughing may enable you to cope better with pain.”