The transitions between ecosystems (ecotones) are often biodiversity hotspots, but we know little about the forces that shape them. Today, often sharp boundaries with low diversity are found between terrestrial and aquatic ecosystems. This has been attributed to environmental factors that hamper succession. However, ecosystem properties are often controlled by both bottom-up and top-down forces, but their relative importance in shaping riparian boundaries is not known. We hypothesize that (1) herbivores may enforce sharp transitions between terrestrial and aquatic ecosystems by inhibiting emergent vegetation expansion and reducing the width of the transition zone and (2) the vegetation expansion, diversity, and species turnover are related to abiotic factors in the absence of herbivores, but not in their presence. We tested these hypotheses in 50 paired grazed and ungrazed plots spread over ten wetlands, during two years. Excluding grazers increased vegetation expansion, cover, biomass, and species richness. In ungrazed plots, vegetation cover was negatively related to water depth, whereas plant species richness was negatively related to the vegetation N:P ratio. The presence of (mainly aquatic) herbivores overruled the effect of water depth on vegetation cover increase but did not interact with vegetation N:P ratio. Increased local extinction in the presence of herbivores explained the negative effect of herbivores on species richness, as local colonization rates were unaffected by grazing. We conclude that (aquatic) herbivores can strongly inhibit expansion of the riparian vegetation and reduce vegetation diversity over a range of environmental conditions. Consequently, herbivores enforce sharp boundaries between terrestrial and aquatic ecosystems.