The present paper concentrates on the improvement of power quality using a single-phase active power filter (APF) connected to the photovoltaic (PV) array operating in the presence of a non-linear load. A novel controller design, based on the energy stored in the half-bridge shunt APF is proposed to ensure two main objectives at the same time: (i) the transfer of active power to the electrical network by extracting the maximum of active power from the PV panels and regulating the PV voltage to a reference value provided by the MPPT; (ii) the improvement of power factor correction (PFC) by compensating for the harmonic current and reactive power produced by the non-linear load using the backstepping technique and Lyapunov tools. The nonlinear controller is developed in two loops. An inner loop is constituted of a PFC regulator based on the energy stored in the APF to minimize the total harmonic distortion (THD). An outer loop uses a linear PI regulator to regulate PV array voltage. The controller also comprised an observer to estimate the voltage network, which is not accessible to measurements. The performance of the proposed controller is validated by simulation using MATLAB/Simulink.