So instead, he turned to chimps.

Since Jane Goodall’s pioneering work in the 1960s, scientists have constantly observed the Kasakela chimpanzee community in Tanzania's Gombe National Park. They’ve recorded their interactions, and collected stool samples. Using some of this data, Moeller showed that the chimps’ gut microbes are mainly passed horizontally from peer to peer, rather than vertically from parent to child. Although they get their first microbes from their moms, these are eventually overwhelmed by those they pick up from friends.

During seasons when the chimps were more sociable, their microbiomes started to converge. And the most sociable individuals, those who spent most time grooming, touching, or otherwise hanging out with their peers, had the richest diversity of species in their guts.

Jenny Tung and Elizabeth Archie found similar trends among two groups of wild baboons in Kenya’s Amboseli National Park. Those that groomed each other more frequently ended up with more similar microbiomes. As a result, the two groups ended up with their own distinctive communities, even though they lived in overlapping areas and ate the same food. Their separate social networks carved a gulf between their microbial communities.

“These animals are eating food covered in dirt and drinking from muddy waterholes, but despite that, we saw signatures of contact with other animals,” says Archie. “You could argue that the effect would be even stronger in humans because we live in such sterile environments. Our major exposures are probably each other.”

These results have important implications. If chimps and baboons (and possibly humans) just inherited microbiomes vertically, they would naturally lose some members because of random events, like dietary upheavals. But if they pass microbes through contact, they ensure that species which disappear from an individual still exist within the wider pool—the pan-microbiome. (And with chimps, it's more like the pan-Pan­-microbiome.) “The propagation of microbes through social interaction may be one of the ways in which diversity is maintained in the microbiome over very long evolutionary timescales,” says Moeller.

The benefits of picking up helpful microbes might even have helped to drive the evolution of social living in the first place. This idea was proposed by Michael Lombardo in 2008; he predicted that if animals get microbes from their peers, they’re more likely to have a more complex social system that regularly brings them into close contact with their contemporaries.

The hypothesis makes intuitive sense and some creatures seem to fit the pattern well. By eating each others’ poop, bumblebees pick up microbes that protect them from parasites; termites do the same through anal licking, and both insects live in cooperative colonies. “Bees have distinct microbiomes, but asocial wasps don’t as much,” adds Moeller. “Primates are some of the most social mammals and have these very consistent microbiomes that track host lineages.”

Still, Lombardo’s hypothesis “is pretty much speculation at this point,” says Moeller. “We’d need to map degree of sociality to some measure of microbial diversity across the tree of life.”

We want to hear what you think about this article. Submit a letter to the editor or write to letters@theatlantic.com.