Captive animals and wild animals may exhibit different characteristics due to the heterogeneity of their living environments. The gut microbiota play an important role in the digestion and absorption, energy metabolism, immune regulation, and physiological health of the host. However, information about the gut microbiota of captive and wild Gekko gecko is currently limited. To determine the difference in gut microbiota community composition, diversity, and structure between captive and wild geckos, we used the Illumina miseq platform to conduct high-throughput sequencing and bioinformatics analysis of the v3–v4 hypervariable region of 16S rRNA in 54 gecko samples. Our results showed that Proteobacteria, Firmicutes, Bacteroidetes, and Actinobacteria were the dominant gut microbiota phyla of the gecko. The dominant genera comprised mainly Pseudomonas, Burkholderia-caballeronia-paraburkholderia, Ralstonia, Romboutsia, and Bacteroides. Captive geckos had significantly higher alpha diversity and potential pathogenic bacteria than wild populations. Moreover, significant differences in beta diversity of gut microbiota were observed between two populations. Functional prediction analysis showed that the relative abundance of functional pathways of wild geckos was more higher in metabolism, genetic information processing and organismal system function than those in captive geckos. Total length significantly affected gut microbial community (R2 = 0.4527, p = 0.001) and explained 10.45% of the total variation for gut microbial community variance between two groups. These results may be related to differences in diet and living environment between two populations, suggesting that the management of captive populations should mimic wild environments to the greatest extent possible to reduce the impact on their gut microbiota.