In the quest for sustainable and efficient energy solutions, hydrogen fuel cells emerge as a beacon of hope, offering a promising pathway towards a greener future. Accurate Identification of the ungiven parameters of proton exchange membrane fuel cell (PEMFC) mathematical models is indispensable for designing, managing, and simulating the practical PEMFC. In order to identify the parameters of PEMFC punctually, this paper presents a modified version of the slime mould algorithm (MSMA). In order to increase capability of the MSMA in the exploitation phase, both locally and globally, the sine-cosine technique has been utilized to boost the search capabilities. To assess the performance of MSMA, MSMA is first utilized to address ten well-known benchmark functions. The obtained results confirm that MSMA outperforms SMA on all benchmark functions. Then, MSMA is employed to solve the optimization problem of different mechanical design problems and also the MSMA provides superior performance over the standard SMA. Finally, the MSMA is used to identify the unknown parameters of four typical PEMFCs: 250W PEMFC, BCS 500W PEMFC, AVISTA SR-12 model, and the Temasek 1 kW PEMFC model. Experimental results boost the supremacy of MSMA in the PEMFC parameters extraction by comparing it with the original SMA and well-known potent optimization techniques. Furthermore, MATLAB/Simulink is employed for advanced dynamic PEMFC modeling, facilitating a comprehensive assessment of fuel cell parameters. The validation of this dynamic PEMFC model, using MSMA-optimized parameters, establishes its practical utility in system analysis and real-world fuel cell operation, marking a significant advancement in PEMFC technology management and simulation.