Spatial separation into acidogenic and methanogenic stages is considered a viable option to ensure process stability, energy efficiency and the better control of key anaerobic digestion (AD) parameters. The elucidation of the optimal modes of two-stage AD for the maximization of the recovery of biofuels (H2 and CH4) is still an urgent task, the main optimization criteria being the highest energy yield (EY) and energy production rate (EPR). In this work, a response surface methodology was used for an optimization of energy production from the two-stage mesophilic–thermophilic AD of cheese whey (CW). Three dilution rates of CW, providing values of 10.9, 14.53 and 21.8 g for the chemical oxygen demand (COD)/L in the influent and three hydraulic retention times (HRTs) (1, 2 and 3 days) in methanogenic biofilters at a constant HRT in an acidogenic biofilter of 0.42 days, were tested to optimize the EY and EPR. The desirability approach produced combined optimum conditions as follows: the dilution rate of the CW provided 17.58 g COD/L (corresponding to OLR of 6.5 g COD/(L·day)) in the influent and a HRT in the methanogenic biofilter of 2.28 days, both of which provided a maximum EPR of 80.263 kJ/(L·day) and EY of 9.56 kJ/g COD, with an overall desirability value of 0.883.