Efficient and stable operation is critical for the large-scale commercialization of the proton exchange membrane fuel cell power system. The effective control and optimization of the operating conditions, such as oxygen excess ratio and cathode pressure of the air supply system, is a solution to improve the overall system efficiency. This work proposes a novel layered control method to achieve rapid and stable control of the operating conditions. The control structure in this paper consists of the optimization and control layers. A two-dimensional objective optimization function for the optimization layer is established to characterize the system efficiency based on theoretical analysis and experimental testing on the fuel cell power generation process and air supply system power consumption pattern. Then, a modified salp swarm algorithm with adaptive inertia weight is proposed to quickly and accurately obtain the optimal operating conditions for the maximum efficiency under different load current densities. Meanwhile, the local optimal solutions are avoided by introducing mutation operations. For the control layer, a third-order state space equation is developed to accurately describe the operating characteristics of the air supply system according to its operating principles. A feedback linearization-based sliding mode controller is designed to achieve rapid and stable control of the optimal working conditions outputted from the optimization layer. Finally, the fuel cell system was tested in the lab and verified on the fuel cell city buses. The results show that the system's operating efficiency is improved by 0.6 %–2.6 % at different current densities, and the hydrogen consumption of all three city buses is reduced by more than 5 %. The optimization effect was enhanced significantly. Therefore, the layered control method is effective in solving the optimization and control problems of the fuel cell power system.