A 454 high-throughput pyrosequencing approach was used to characterize the structures of microbial communities in wetland mesocosms receiving caffeine-enriched wastewater at a concentration of 250 μg L −1. The removal efficiencies of caffeine in the planted beds (93.0 %) were significantly (p < 0.05) higher than those in the unplanted beds (81.4 %). Bacterial diversity was decreased by 25 and 22.4 %, respectively, in both planted and unplanted mesocosms after 210-day operation. The results of taxonomic analyses suggested that chronic exposure of wetland ecosystems to caffeine could lead to moderate shifts in microbial community composition. In total, 2156 operational taxonomic units (OTUs) were generated and 20 phyla comprising 260 genera were identified. The major phylogenetic groups at phylum level included Firmicutes (39 %), Actinobacteria (25.1 %), Proteobacteria (17.1 %), Synergistetes (5.6 %), and Chloroflexi (5.5 %).Bacilli and Synergistia increased in abundance in the planted mesocosms, while for the unplanted mesocosms, Actinobacterial, Clostridia and Betaproteobacteria exhibited increased proportion under the exposure of caffeine. At genus level, Propionibacterium, Staphylococcus, Bacillus, and Streptococcus were found to be increased in abundance after caffeine treatment. As for the response of fungal community to caffeine enrichment, genus like Cladosporium, Emericellopsis, Aspergillus, and Phoma were found to be resistant to caffeine disturbance. When compared to the microbial community between planted and unplanted mesocosms, a distinct community profile for both bacteria and fungi community was observed. The presence of plants had a remarkable effect on the structure of microbial community, helping buffer against the stress associated with caffeine exposure.