In this article we perform a full microstructure optimization of the catalyst layer in proton exchange membrane fuel cells by computing the optimum distributions of the platinum particles, nafion and carbon. Our approach is based on evaluating the sensitivity functions of the cell voltage under specified current conditions and using these sensitivity functions in a gradient-based optimization algorithm design to converge towards the optimum microstructure of the cell. Since the optimization requires finding the combined optimum distributions of the platinum particles, nafion and carbon, our approach requires the calculation of all three sensitivity functions, which are related to the Gâtaux derivatives of the discharge voltage with respect to the design variables. We find that it is optimum to increase the density of the platinum particles and the amount of the electrolyte near the membrane side of the catalyst layer and, at the same time, increase the porosity and carbon fraction near the gas diffusion layer.