When it comes to reducing emissions caused by the generation of electricity through conventional sources, among different renewable energies, the solar gains prominence, due to its geographical availability, simplicity of implementation and absence of moving parts. However, the performance of photovoltaic systems is dependent on environmental conditions. Depending on temperature and solar irradiation, the PV system has an operating point where maximum power can be generated. The techniques that are implemented to find this operating point are the so-called maximum power point tracking (MPPT) algorithms. Since weather conditions are variable in nature, the output voltage of the PV system needs to be regulated to remain equal to the reference. Most of the existing studies focus either on MPPT or on voltage regulation of the PV system. In this paper, the two-stage PV system is implemented so that both MPPT and voltage regulation are achieved simultaneously. Additionally, an improved version of the Perturb and Observe (P&O) algorithm based on artificial potential fields (APF), called APF-P&O, is proposed. Sliding Mode Controllers with appropriate control laws are designed for both stages of conversion. Simulations performed in MATLAB/Simulink software prove the superiority of the proposed APF-P&O method over the conventional P&O method in terms of convergence time, output power ripples and sensitivity to step sizes. At the same time, the voltage regulation issue is also solved, where the output voltage is fixed to the value of 32 V, regardless of variations in solar irradiation.