For the calculation of the electron correlation energy, usual Koopmans one-electron energies (used in Møller-Plesset partitioning) are replaced by energy-optimized ones to form the denominators of the many-body perturbation theory. Changing these quasiparticle energies can be interpreted as applying special level shifts to the zero-order Hamiltonian, thus it is related to the problem of partitioning in the perturbation theory. The energy functional chosen to be optimized with respect to the quasiparticle energies is the Rayleigh quotient evaluated with the first-order wavefunction Ansatz, expanded up to the third order. The resulting level shifts preserve size extensivity of the many-body perturbation theory.