The diffusion layer is a crucial part of most fuel cells and electrolyzers. We analytically solve a simplified set of visco-capillary equations for the gas and liquid saturation profiles inside such layers. Contrary to existing numerical simulations, this approach allows us to obtain general scaling relations. We derive simple explicit equations for the limiting current density associated with reactant starvation, flooding, and membrane dehydration, including the effect of fluid properties, contact angle, tortuosity, and the pore size distribution. This is the first explicit, extensive and thorough analytical modeling framework for the two-phase transport in an electrochemical cell that provides useful insights into the performance characteristics of the diffusion layer. A more even pore size distribution generally allows higher currents. Explicit expressions for the inimmum pore size and maximum layer thickness show that modern diffusion layers are typically well-designed.