Your friend comes over after a bad day. Huffing and puffing, he brings it all to you: His boss was a jerk, he accidentally deleted his presentation, and spilled coffee on a new white shirt. Suddenly, you find yourself tense, even though you were having a relaxed day.

What gives?

There’s a name for the phenomenon of stress spreading: second-hand anxiety. Second-hand anxiety, or second-hand stress, is not a psychological diagnosis, illness, or disorder. It is, rather, a neurological phenomenon that refers to the way emotions spread.

Understanding how second-hand anxiety works not only teaches us more about the social nature of emotions, but can also help us keep our cool when other people’s negative emotions overwhelm us.

The Science of Spreading Stress

How does second-hand anxiety work? It’s all in the mirror neurons.

Mirror neurons are cells in the brain that produce an empathetic response to the behaviors we witness around us. Ever sneezed because someone around you sneezed or felt pain watching someone else get injured either in-person or on film? Those are your mirror neurons at work!

Mirror neurons fire when we see someone doing a particular action, like lifting their arm. Since they are also some of the same neurons responsible for performing that very action ourselves, we experience an empathetic response. Researchers argue that mirror neurons can help explain emotional empathy, too.

In fact, several studies have found that emotion is communicated on the level of the body itself. One study found that people tend to echo the emotions of gesturally expressive people around us. Another found that people experience an increase in cortisol levels, which indicate stress, even from seeing a stranger express stress on a video screen — and the effect increases significantly if the stressed out is a loved one. Yet another study found that even smelling the sweat of an anxious person can increase our stress levels.

And while the occasional bad mood doesn’t mean much in the long-run, the effects of second-hand stress can be serious. In one study, for example, non-depressed pregnant women with depressed partners experienced more premature births than women whose partners did not have a mood disorder. Pretty crazy, huh?

How to Stop Second-hand Anxiety

Here’s the good news: If we can pick up anxiety from the environment, we can also receive (and transmit!) joy. Here’s how to support those around you without losing your own cool — and how spread more positive emotions.

Listen Empathically

When a loved one comes to you feeling stressed, they’re looking for a listening ear and a space to feel understood. Actively remind yourself that the emotions they’re expressing aren’t about you — they’re about whatever situation is stressing your loved one out.

Maintaining mental and emotional distance from their stressor doesn’t mean being cold. Instead, practice active listening by mirroring what they’re saying (“It sounds like you’re feeling overwhelmed”) and asking gentle follow-up questions (“What did you say to her?”). Your role is to help give perspective, not lose your own.

Set Boundaries

We want to be there for the people we care about, but the truth is that sometimes it’s better to disengage for a bit rather than engage only to have the negative emotions build and lead to conflict.

Leaving a stressful situation or suggesting that you talk more when you’ve both calmed down is responsible, not cold. In public or professional settings, you can actively choose not to engage with an anxious person to distance yourself from the stress. Or you can gently ask them what’s up and if the community can help collectively address the issue.

Make Mirror Neurons Work for You

The good news about mirror neurons is that just as they can work against you in the case of second-hand stress, they can also work for you. Use empathy to your advantage by engaging with other people’s positive emotions: Anything from listening to happy music, congratulating a friend for their success, or playing with your sister’s giggling baby. Or watch a how-to massage video on YouTube and feel the muscles in your own back melt. Thanks, mirror neurons!

Spread Positivity

Human beings are inherently social animals. While learning about second-hand anxiety can make you feel, well, anxious, it doesn’t have to. Instead, practice those positive thinking skills by choosing to be awed by human beings’ incredible sensitivity and empathy. And next time you find a stranger’s smile infectious, thank the miraculous human brain.