The use of solar energy as a source of clean energy is increasing throughout the world. Therefore, designing higher-quality photovoltaic cells has attracted researches. Several equivalent circuits have been proposed for the photovoltaic cell, but it is necessary to note that in order to achieve maximum power point (MPP), finding appropriate circuit model parameters is required. Many methods for finding the optimal parameters have been proposed. In this paper, flexible particle swarm optimization (FPSO) algorithm is proposed to estimate the parameters of PV cell model. In this algorithm, an elimination phase is added to classic PSO. At the beginning of each phase, a certain number of worst particles are deleted and some new particles are replaced in the new search space. Also, the search space of the parameters in each particle is changed based on the value of these parameters. These modifications have enhanced the proposed algorithm performance by adding the ability of global search and also searching in a reasonable space. To highlight the superiority of the FPSO algorithm, this method is used to estimate the parameters of the single diode model, double diode model, and the photovoltaic module. In order to illustrate the proficiency of the proposed approach, it is compared to other well-known optimization methods. Furthermore, to ensure the practical use of the FPSO algorithm, it is validated by three different solar modules such as monocrystalline (SM55) and multi-crystalline (KC200GT) and polycrystalline (SW255). The simulation results show that the proposed algorithm has high performance in terms of accuracy and robustness.