Natural habitats vary in available nutrients and room for bacteria to grow, but successful colonization can lead to overcrowding and stress. Here we show that competing sibling colonies of Paenibacillus dendritiformis bacteria survive overcrowding by switching between two distinct vegetative phenotypes, motile rods and immotile cocci. Growing colonies of the rod-shaped bacteria produce a toxic protein, Slf, which kills cells of encroaching sibling colonies. However, sublethal concentrations of Slf induce some of the rods to switch to Slf-resistant cocci, which have distinct metabolic and resistance profiles, including resistance to cell wall antibiotics. Unlike dormant spores of P. dendritiformis, the cocci replicate. If cocci encounter conditions that favor rods, they secrete a signaling molecule that induces a switch to rods. Thus, in contrast to persister cells, P. dendritiformis bacteria adapt to changing environmental conditions by inducible and reversible phenotypic switching. In favorable environments, species may face space and nutrient limits due to overcrowding. Bacteria provide an excellent model for analyzing principles underlying overcrowding and regulation of density in nature, since their population dynamics can be easily and accurately assessed under controlled conditions. We describe a newly discovered mechanism for survival of a bacterial population during overcrowding. When competing with sibling colonies, Paenibacillus dendritiformis produces a lethal protein (Slf) that kills cells at the interface of encroaching colonies. Slf also induces a small proportion of the cells to switch from motile, rod-shaped cells to nonmotile, Slf-resistant, vegetative cocci. When crowding is reduced and nutrients are no longer limiting, the bacteria produce a signal that induces cocci to switch back to motile rods, allowing the population to spread. Genes encoding components of this phenotypic switching pathway are widespread among bacterial species, suggesting that this survival mechanism is not unique to P. dendritiformis.