Animal sociality facilitates the transmission of pathogenic microorganisms among hosts, but the extent to which sociality enables animals' beneficial microbial associations is poorly understood. The question is critical because microbial communities, particularly those in the gut, are key regulators of host health. We show evidence that chimpanzee social interactions propagate microbial diversity in the gut microbiome both within and between host generations. Frequent social interaction promotes species richness within individual microbiomes as well as homogeneity among the gut community memberships of different chimpanzees. Sampling successive generations across multiple chimpanzee families suggests that infants inherited gut microorganisms primarily through social transmission. 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.