The role of density compensation (the decline of species density with increasing diversity), in the context of biodiversity and ecosystem functioning, has not been explicitly explored. I used aquatic microbial communities containing bacterivorous consumers (protozoans and rotifers) to investigate whether competition can lead to density compensation and whether density compensation can contribute to the relationship between biodiversity and ecosystem functioning. The experiment employed a nested design in which the consumer diversity gradient (0, 1, 2 or 4 species) was constructed by drawing all possible species or species combinations at each diversity level from a five-species pool. All consumer species coexisted but there was little evidence for overyielding or species dominance, suggesting weak complementarity and sampling effects. Rather, increasing number of consumer species resulted in community-wide density compensation, such that aggregate consumer biomass was unaffected by consumer diversity. Whereas culturable bacterial density declined as consumer diversity increased, total bacterial density showed no discernible response to changes in consumer diversity, a result probably due in part to heterogeneity in bacterial edibility. This study demonstrates the potential for density compensation to shape the relationship between biodiversity and ecosystem functioning.