Interactions between species provide the basis for understanding coexisting mechanisms. The plateau pika (Ochotona curzoniae) and the yak (Bos grunniens) are considered competitors because they have shared habitats and consumed similar food on the Qinghai–Tibetan Plateau for more than 1 million years. Interestingly, the population density of plateau pikas increases with yak population expansion and subsequent overgrazing. To reveal the underlying mechanism, we sequenced the fecal microbial 16S rDNA from both sympatric and allopatric pikas and yaks. Our results indicated that sympatry increased both gut microbial diversity and similarity between pikas and yaks. The abundance of Firmicutes, Proteobacteria, Cyanobacteria, and Tenericutes decreased, while that of Verrucomicrobia increased in sympatric pikas. As for sympatric yaks, Firmicutes, Bacteroidetes, and Spirochaetes significantly increased, while Cyanobacteria, Euryarchaeota, and Verrucomicrobia significantly decreased. In sympatry, plateau pikas acquired 2692 OTUs from yaks, and yaks obtained 453 OTUs from pikas. The predominant horizontally transmitted bacteria were Firmicutes, Bacteroidetes, Verrucomicrobia, and Proteobacteria. These bacteria enhanced the enrichment of pathways related to prebiotics and immunity for pikas, such as heparin sulfate, heparin, chitin disaccharide, chondroitin-sulfate-ABC, and chondroitin-AC degradation pathways. In yaks, the horizontally transmitted bacteria enhanced pathways related to hepatoprotection, xenobiotic biodegradation, and detoxification. Our results suggest that horizontal transmission is a process of selection, and pikas and yaks tend to develop reciprocity through the horizontal transmission of gut microbiota.