Much of the literature on optimal monetary policy uses models in which the degree of nominal price flexibility is exogenous. There are, however, good reasons to suppose that the degree of price flexibility adjusts endogenously to changes in monetary conditions. This article extends the standard new Keynesian model to incorporate an endogenous degree of price flexibility. The model shows that endogenizing the degree of price flexibility tends to shift optimal monetary policy towards complete inflation stabilization, even when shocks take the form of cost-push disturbances. This contrasts with the standard result obtained in models with exogenous price flexibility, which show that optimal monetary policy should allow some degree of inflation volatility to stabilize the welfare-relevant output gap.