Despite the success of demand response programs in retail electricity markets in reducing average consumption, the literature shows failure to reduce the variance of consumers’ responses. This paper aims at designing demand response contracts which allow to act on both the average consumption and its variance. The interaction between the producer and the consumer is modeled as a Principal-Agent problem, thus accounting for the moral hazard underlying demand response programs. The producer, facing the limited flexibility of production, pays an appropriate incentive compensation in order to encourages the consumer to reduce his average consumption and to enhance his responsiveness. We provide closed-form solution for the optimal contract in the case of linear energy valuation. Without responsiveness incentive, this solution decomposes into a fixed premium for enrolment and a proportional price for the energy consumed, in agreement with previously observed demand response contracts. The responsiveness incentive induces a new component in the contract with payment rate on the consumption quadratic variation. Furthermore, in both cases, the components of the premium exhibit a dependence on the duration of the demand response event. In particular, the fixed component is negative for sufficiently long events. Finally, under the optimal contract with optimal consumer behaviour, the resulting consumption volatility may decrease as required, but it may also increase depending on the risk aversion parameters of both actors. This agrees with standard risk sharing effects. The calibration of our model to publicly available data of a large scale demand response experiment predicts a significant increase of responsiveness under our optimal contract, a significant increase of the producer satisfaction, and a significant decrease of the consumption volatility. The stability of our explicit optimal contract is justified by appropriate sensitivity analysis.