Social contact can clearly spread disease: That’s why we lean away from snotty hugs, tell sick colleagues to go home, and quarantine people during epidemics. But the germs behind infectious illnesses are but a tiny fraction of our full microbiome—the microbes that share our bodies. Most of these are harmless, perhaps even helpful. And they can hop between individuals, too.

A growing number of studies, including two recent ones with chimps and baboons, have shown that social interactions affect the composition of the microbiome. Through hugs, handshakes, and even hip-checks, we translate our social networks into microbial ones, transferring benign or beneficial microbes to our neighbors, and acquiring theirs in return.

This means that there’s a “pan-microbiome”—a meta-community of microbe species that spans a group of hosts. If you compare your microbiome to your private music collection, the pan-microbiome is like the full iTunes store, and every handshake is an act of file-sharing.

There’s some evidence that humans share microbes through physical contact. In one study, people who share living quarters end up with similar microbes. In another, the skin microbes of opposing roller-derby teams converge during a game. But these were snapshots. To study how social ties affect the microbiome, you’d ideally want to track people over long periods—everything from the friends they hung out with to the bacteria in their poop. “You’d have to invade their privacy to an extent that most people probably wouldn’t put up with,” says Andrew Moeller from the University of California, Berkeley.

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.”