When it comes to reducing emissions caused by the generation of electricity, among different renewable energy sources, the solar energy gains prominence, due to its geographical availability, simplicity of implementation, and absence of physical moving parts. However, the performance of photovoltaic systems is dependent on environmental conditions. Depending on temperature and solar irradiation, the photovoltaic (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 presented. According to the results of the simulations carried out in MATLAB/Simulink software, the APF-P&O method is more efficient than the conventional method.