Abstract Microorganisms mainly exist within complex networks of ecological interactions. Given that the growth and survival of community members frequently depend on an obligate exchange of essential metabolites, it is generally unclear how such communities can persist despite the destabilizing force of ecological disturbance. Here we address this issue using a population dynamics model. In contrast to previous work that suggests the potential for obligate interaction networks to evolve is limited, we find the opposite pattern: natural selection in the form of ecological disturbance favors both specific network topologies and cooperative cross-feeding among community members. These results establish environmental selection as a key driver shaping the architecture of microbial interaction networks.