Organisms-especially microbes-tend to live together in ecosystems. While some of these ecosystems are very biodiverse, others are not, and while some are very stable over time, others undergo strong temporal fluctuations. Despite a long history of research and a plethora of data, it is not fully understood what determines the biodiversity and stability of ecosystems. Theory and experiments suggest a connection between species interaction, biodiversity and the stability of ecosystems, where an increase in ecosystem stability with biodiversity could be observed in several cases. However, what causes these connections remains unclear. Here, we show in microbial ecosystems in the laboratory that the concentrations of available nutrients can set the strength of interactions between bacteria. High nutrient concentrations allowed the bacteria to strongly alter the chemical environment, causing on average more negative interactions between species. These stronger interactions excluded more species from the community, resulting in a loss of biodiversity. At the same time, the stronger interactions also decreased the stability of the microbial communities, providing a mechanistic link between species interaction, biodiversity and stability in microbial ecosystems.