The human gut microbiota is affected by genetic and environmental factors. It remains unclear how host genetic and environmental factors affect the composition and function of gut microbiota in populations living at high altitudes. We used a metagenome-wide analysis to investigate the gut microbiota composition in 15 native Tibetans and 12 Hans living on the Tibetan Plateau. The composition of gut microbiota differed significantly between these two groups (P < 0.05). The Planctomycetes was the most abundant phyla both in native Tibetans and in Hans. Furthermore, the most relatively abundant phyla for native Tibetans were Bacteroidetes (15.66%), Firmicutes (11.10%), Proteobacteria (1.32%), Actinobacteria (1.10%), and Tenericutes (0.35%), while the most relatively abundant phyla for Hans were Bacteroidetes (16.28%), Firmicutes (8.41%), Proteobacteria (2.93%), Actinobacteria (0.49%), and Cyanobacteria (0.21%). The abundance of the majority of genera was significantly higher in Tibetans than in Hans (P < 0.01). The number of microbial genes was 4.9 times higher in Tibetans than in Hans. The metabolic pathways and clusters of orthologous groups differed significantly between the two populations (P < 0.05). The abundance of carbohydrate-active enzyme modules and antibiotic resistance genes was significantly lower in Tibetans compared to Hans (P < 0.05). Our results suggest that different genetic factors (race) and environmental factors (diets and consumption of antibiotics) may play important roles in shaping the composition and function of gut microbiota in populations living at high altitudes.