If you've ever felt like a social leper, it might be because you're not getting enough sleep, according to researchers who have found that people subconsciously avoid sleep-deprived individuals like raisins in cookies.

A new study shows that people who aren’t getting enough sleep actually engage less with others and avoid close contact similarly to people with social anxiety. Even worse, it seems to be contagious. Well-rested people are likely to avoid people who are sleep-deprived, and after having to spend time with them, become more lonely themselves.

“We humans are a social species. Yet sleep deprivation can turn us into social lepers," said the study's senior author Matthew Walker - a UC Berkeley professor of psychology and neuroscience.

Researchers studied this phenomenon by looking at the brain scans of well-rested and sleep deprived people as they watched videos of people walking towards them. The images of sleep-deprived people advancing made the test subjects' brain activity react in the same way as when someone invades our personal space. 

"The less sleep you get, the less you want to socially interact. In turn, other people perceive you as more socially repulsive, further increasing the grave social-isolation impact of sleep loss," Walker added. "That vicious cycle may be a significant contributing factor to the public health crisis that is loneliness."

So if you've had too much alone time recently, it might be time to get reacquainted with your pillow.