Challenging the paradigm of the maximum tolerated dose, recent studies have shown that a strategy aiming for containment, not elimination, can control tumor burden more effectively in vitro, in mouse models, and in the clinic. These outcomes are consistent with the hypothesis that emergence of resistance to cancer therapy may be prevented or delayed by exploiting competitive ecological interactions between drug-sensitive and resistant tumor cell subpopulations. However, although various mathematical and computational models have been proposed to explain the superiority of particular containment strategies, this evolutionary approach to cancer therapy lacks a rigorous theoretical foundation. Here we combine extensive mathematical analysis and numerical simulations to establish general conditions under which a containment strategy is expected to control tumor burden more effectively than applying the maximum tolerated dose. We show that when resistant cells are present, an idealized strategy of containing a tumor at a maximum tolerable size maximizes time to treatment failure (that is, the time at which tumor burden becomes intolerable). These results are very general and do not depend on any fitness cost of resistance. We further provide formulas for predicting the clinical benefits attributable to containment strategies in a wide range of scenarios, and we compare outcomes of theoretically optimal treatments with those of more practical protocols. Our results strengthen the rationale for clinical trials of evolutionarily-informed cancer therapy.