Abstract Background Agricultural activities inevitably result in anthropogenic interference with natural habitats. The diet and the gut microbiota of farmland wildlife can be altered due to the changes in food webs within agricultural ecosystems. In this work, we compared the diet and intestinal microbiota of the frog Fejervarya limnocharis in natural and farmland habitats in order to understand how custom farming affects the health of in vivo microbial ecosystems. Results The occurrence, abundance, and the numbers of prey categories of stomach content were significantly different between the frogs inhabiting natural and farmland habitats. In addition, differences in the abundance, species richness, and alpha-diversity of intestinal microbial communities were also statistically significant. The microbial composition, and particularly the composition of dominant microbes living in intestines, indicated that the land use practices might be one of factors affecting the gut microbial community composition. Although the first three dominant microbial phyla Bacteroidetes, Firmicutes, and Proteobacteria found in the intestines of frogs were classified as generalists among habitats, the most dominant gut bacterial phylum Bacteroidetes in natural environments was replaced by the microbial phylum Firmicutes in farmland frogs. Increased intestinal microbial richness of the farmland frogs, which is mostly contributed by numerous microbial species of Proteobacteria, Actinobacteria, Acidobacteria, and Planctomycetes, not only reflects the possible shifts in microbial community composition through the alteration of external ecosystem, but also indicates the higher risk of invasion by disease-related microbes. Conclusions This study indicates that anthropogenic activities, such as the custom farming, have not only affected the food resources of frogs, but also influenced the health and in vivo microbial ecosystem of wildlife.