Mangrove swamp is one of the world's richest and most productive marine ecosystems. This ecosystem also has a great ecological importance, but is highly susceptible to anthropogenic disturbances. The balance of mangrove ecosystem depends largely on the microbial communities in mangrove sediments. Thus, understanding how the mangrove microbial communities respond to spatial differences is essential for more accurate assessment of mangrove ecosystem health. To this end, we performed the first medium-distance (150 km) research on the biogeographic distribution of mangrove microbial communities. The hypervariable regions of 16S rRNA gene was sequenced by Illumina to compare the microbial communities in mangrove sediments collected from six locations (i.e. Zhenzhu harbor, Yuzhouping, Maowei Sea, Qinzhou harbor, Beihai city and Shankou) along the coastline of Beibu Gulf in Guangxi province, China. Collectively, Proteobacteria, Bacteroidetes, Chloroflexi, Actinobacteria, Parvarchaeota, Acidobacteria and Cyanobacteria were the predominant phyla in the mangrove sediments of this area. At genus level, the heat map of microbial communities reflected similarities between study sites and was in agreement with their biogeographic characteristics. Interestingly, the genera Desulfococcus, Arcobacter, Nitrosopumilus and Sulfurimonas showed differences in abundance between study sites. Furthermore, the principal component analysis (PCA) and unweighted UniFrac cluster tree of beta diversity were used to study the biogeographic diversity of the microbial communities. Relatively broader variation of microbial communities was found in Beihai city and Qinzhou harbour, suggesting that environmental condition and historical events may play an important role in shaping the bacterial communities as well. This is the first report on medium-distance range distribution of bacteria in the mangrove swamp ecosystem. Our data is valuable for monitoring and evaluation of the impact of human activity on mangrove habitats from the perspective of microbiome.