The affine projection algorithm with a fixed regularization parameter is subject to a compromise concerning the convergence speed and steady-state misalignment. To address this problem, we propose to employ a variable mixing factor to adaptively combine two different regularization factors in an attempt to put together the best properties of them. The selection of the mixing factor is derived by minimizing the energy of the noise-free a posteriori error, and for the sake of suppressing large fluctuations, a moving-average method is designed for updating the mixing factor. Based on a random walk model, we also prove that the proposed mixing factor is as well available for the non-stationary system. The mathematical analysis including the stability performance, steady-state mean square error, and computational complexity are performed. In practice, we compare with the existing related algorithms in system identification and echo cancellation scenarios, the results illustrate that the proposed algorithm outperforms them with notable margins.