An extremum-seeking control system includes a plant operable to affect a variable state or condition of a building and an extremum-seeking controller. The extremum-seeking controller is configured to provide a control input to a plant and receive a performance variable as a first feedback from the plant. The plant uses the control input to affect the performance variable. The extremum-seeking controller is configured to receive a constrained variable as a second feedback from the plant and calculate a performance penalty by applying a penalty function to the constrained variable. The extremum-seeking controller is further configured to modify the performance variable with the performance penalty to generate a modified cost function, estimate a gradient of the modified cost function with respect to the control input, and drive the gradient of the modified cost function toward zero by modulating the control input.