The control of voltage of Proton Exchange Membrane Fuel Cell (PEMFC) which is one of the most important types of fuel cell, during system load variations has been described. Fuel cell output voltage should be kept in a constant value against the load variations and a controller should be designed for this purpose. Accordingly, the modified PID controller has been proposed which is optimized based on Hybrid Particle Swarm optimization with Time Varying Acceleration Coefficients (HPSOTVAC) and Bacteria Foraging Algorithm (BFA). In order to use this hybrid technique, at first, the proposed problem is written as an optimization problem which consists of the objective function and constraints, and then to achieve the most desirable controller, hybrid technique is applied to solve the problem. Simulation results are operated in various loads in time domain, and the results show the efficiency of the proposed controller in contrast to the previous controllers. Simulation results demonstrate the good accuracy of the proposed controller performance by considering the problem solving.