Sediment-dwelling macroinvertebrates alter their habitat by transporting oxic water into the sediment and enriching it for organic matter, thereby affecting microbial processes in the sediment. Here we report that burrowing macroinvertebrates can also have a pronounced effect on microbial diversity, with nitrate-reducing and denitrifying bacteria as examples. The diversity of these functional groups was compared in sediment microcosms with and without Chironomus plumosus larvae, using the genes encoding nitrate reductase (narG) and nitrous oxide reductase (nosZ) as functional markers. The estimated phylotype richness of narG increased from 68 in sediment without larvae to 170 in sediment with larvae. Part of this increase in narG diversity could be explained by metabolic activation of certain nitrate-reducing bacteria in the gut of C. plumosus, since 18.3 % of the additional phylotypes were found actively expressed in the gut contents of C. plumosus. The remaining increase may be due to the creation of a (on the microscale) more structured habitat by larval activities like burrow construction, bioturbation, and water pumping, possibly combined with a general activation of microbes by enriching the sediment with partly degraded organic material excreted by the larvae. In contrast to narG, nosZ phylotype richness was unaffected by the presence of chironomid larvae, and very few nosZ phylotypes were actively expressed in the larvae gut. Our results suggest that burrowing macroinvertebrates affect the microbial diversity in sediments, both indirectly by their behaviour and directly by activating certain functional groups of microorganisms passing through their gut.