Starvation triggers bacterial spore formation, a committed differentiation program that transforms a vegetative cell into a dormant spore. Cells in a population enter sporulation nonuniformly to secure against the possibility that favorable growth conditions, which put sporulation-committed cells at a disadvantage, may resume. This heterogeneous behavior is initiated by a passive mechanism: stochastic activation of a master transcriptional regulator. Here, we identify a cell-cell communication pathway containing the proteins ShfA (YabQ) and ShfP (YvnB) that actively promotes phenotypic heterogeneity, wherein Bacillus subtilis cells that start sporulating early use a calcineurin-like phosphoesterase to release glycerol, which simultaneously acts as a signaling molecule and a nutrient to delay nonsporulating cells from entering sporulation. This produced a more diverse population that was better poised to exploit a sudden influx of nutrients compared to those generating heterogeneity via stochastic gene expression alone. Although conflict systems are prevalent among microbes, genetically encoded cooperative behavior in unicellular organisms can evidently also boost inclusive fitness.