Being in close contact with people often conjures the image of the quick spread of disease and bacteria; a crowded subway car during the morning rush hours of flu season is a hotbed for the spread of viruses and bacteria, for example.

But being around others and socializing encourages the spread of good bacteria too, according to a new study out of Duke University. It turns out that isolation — a limited diet, and isolation from other living things — might actually be detrimental to our gut microbes.

The researchers examined wild chimpanzees in Gombe National Park, Tanzania over the course of eight years. Between 2000 and 2008, the researchers gathered droppings from 40 chimpanzees, then examined their bacterial DNA. They also measured what the chimps ate, how social they were, and how much time they spent alone. Typically, chimps socialize more during the wet season, when they have more food to eat and share — they spend more time alone during the dry season.

They found that extroverted chimps had a more diverse microbiome in their gastrointestinal tracts than chimps who were less socially active. Of course, changes in the amount and type of food during different seasons also played a role, but the researchers believe that social interaction had a larger influence than previously believed. It’s possible that gut bacteria can be transferred among chimps during social contact like grooming or mating.

The study is important because “microbial communities, particularly those in the gut, are key regulators of host health,” the authors wrote in the abstract. Indeed, having a stronger, more diverse amount of bacteria in your gut strengthens your immune system, fights inflammation, and improves mental health. Interestingly, eating probiotic-rich foods has also been linked to decreasing social anxiety.

Keep in mind that the study was just done in chimpanzees and not humans yet, though chimps share a lot of the same gut bacteria as us. “One of the main reasons that we started studying the microbiomes of chimpanzees was that it allowed us to do studies that have not or cannot be done in humans,” said Howard Ochman, a researcher at the University of Texas at Austin and an author of the study, in the press release. “It’s really an amazing and previously underexplored resource.”

Changes in social behavior are natural, and they happen among all forms of life — hibernation, for example, occurs during the winter months rather than the more gregarious summer. But more research on the health consequences of a less diverse microbiome could help us see when too much isolation is having a harmful effect on our health. Past research has shown that loneliness can have a profoundly negative impact on our physical and mental health, affecting us even on a cellular level.

The authors concluded: “These results indicate that social behavior generates a pan-microbiome, preserving microbial diversity across evolutionary time scales and contributing to the evolution of host species-specific gut microbial communities.”

Source: Moeller A, Foerster S, Wilson M, Pusey A, Hahn B, Ochman H. Social behavior shapes the chimpanzee pan-microbiome. Science Advances, 2016.