With growing interest in the effects of biodiversity on disease, there is a critical need for studies that empirically identify the mechanisms underlying the diversity–disease relationship. Here, we combined wetland surveys of host community structure with mechanistic experiments involving a multi-host parasite to evaluate competing explanations for the dilution effect. Sampling of 320 wetlands in California indicated that snail host communities were strongly nested, with competent hosts for the trematode Ribeiroia ondatrae predominating in low-richness assemblages and unsuitable hosts increasingly present in more diverse communities. Moreover, competent host density was negatively associated with increases in snail species richness. These patterns in host community assembly support a key prerequisite underlying the dilution effect. Results of multigenerational mesocosm experiments designed to mimic field-observed community assemblages allowed us to evaluate the relative importance of host density and diversity in influencing parasite infection success. Increases in snail species richness (from one to four species) had sharply negative effects on the density of infected hosts (∼90% reduction). However, this effect was indirect; competition associated with non-host species led to a 95% reduction in host density (susceptible host regulation), owing primarily to a reduction in host reproduction. Among susceptible hosts, there were no differences in infection prevalence as a function of community structure, indicating a lack of support for a direct effect of diversity on infection (encounter reduction). In monospecific conditions, higher initial host densities increased infection among adult hosts; however, compensatory reproduction in the low-density treatments equalized the final number of infected hosts by the next generation, underscoring the relevance of multigenerational studies in understanding the dilution effect. These findings highlight the role of interspecific competition in mediating the relationship between species richness and parasite infection and emphasize the importance of field-informed experimental research in understanding mechanisms underlying the diversity–disease relationship.