The fuel cell is vital in electrical distribution networks as a distributed generation in today’s world. A precise model of a fuel cell is extensively required as it rigorously affects the simulation studies’ transient and dynamic analyses of the fuel cell. This appears in several microgrids and smart grid systems. This paper introduces a novel attempt to optimally determine all unknown factors of the polymer exchange membrane (PEM) fuel cell model using a meta-heuristic algorithm termed the Lightning search algorithm (LSA). In this model, the current–voltage relationship is heavily nonlinear, including several unknown factors because of the shortage of fuel cell data from the manufacturer’s side. This issue can be treated as an optimization problem, and LSA is applied to detect its ability to solve this problem accurately. The objective function is the sum of the squared error between the estimated output voltage and the measured output voltage of the fuel cell. The constraints of the optimization problem involve the factors range (lower and upper limit). The LSA is utilized in minimizing the objective function. The effectiveness of the LSA-PEM fuel cell model is extensively verified using the simulation results performed under different operating conditions. The simulation results of the proposed model are compared with the measured results of three commercial fuel cells, such as Ballard Mark V 5 kW, BCS 500 W and Nedstack PS6 6 kW, to obtain a realistic study. The results of the proposed algorithm are also compared with different optimized models to validate the model and, further, to determine where LSA stands in terms of precision. In this regard, the proposed model can yield a lower SSE by more than 5% in some cases and high performance of the LSA-PEMFC model. With the results obtained, it can be concluded that LSA prevails as a potential optimization algorithm to develop a precise PEM fuel cell model.