One of the proposed methods to improve the performance of a proton exchange membrane fuel cell is using metal foam within the channels. Here, we performed a 3D numerical simulation and studied the effect of structural properties of metal foam on the system performance. Also, we used artificial neural network to predict three criteria, i.e., maximum temperature, temperature uniformity index, and pressure drop, together with Genetic Algorithm for system optimization. Obtained results indicate that using metal foam can improve the temperature uniformity in the cell, so that maximum temperature and temperature uniformity index are decreased about 1.785 K and 0.7 K, respectively, while resultant increase in overall pressure drop of the system is only about 4.4%. The same amount of maximum temperature reduction is possible by increasing the flow rate; however, this scheme puts 60% more pressure drop upon the system. Moreover, we compared the performance of air-and water-cooling systems and found that for a given pressure drop, the maximum temperature as well as temperature uniform index of an air-cooling system is lower than that of a water-cooling system, while for the same system parasitic power, a system with water coolant has more uniform temperature distribution with lower maximum temperature.