This paper analyzes a two-phase endogenous growth model in which the adoption of a backstop technology (e.g., solar) yields a sustained supply of essential energy inputs previously obtained from exhaustible resources (e.g., oil). Growth is knowledge-driven and the optimal timing of technology switching is determined by welfare maximization. The optimal path exhibits discrete jumps in endogenous variables: technology switching implies sudden reductions in consumption and output, an increase in the growth rate, and instantaneous adjustments in saving rates. Due to the positive growth effect, it is optimal to implement the new technology when its current consumption benefits are substantially lower than those generated by old technologies.