We develop and calibrate a dynamic equilibrium model of relationship lending in which banks are unable to access the equity markets every period and the business cycle is a Markov process that determines loans’ probabilities of default. Banks anticipate that shocks to their earnings and the possible variation of capital requirements over the cycle can impair their future lending capacity and, as a precaution, hold capital buffers. We compare the relative performance of several capital regulation regimes, including one that maximizes a measure of social welfare. We show that Basel II is significantly more procyclical than Basel I, but makes banks safer. For this reason, it dominates Basel I in terms of welfare except for small social costs of bank failure. We also show that for high values of this cost, Basel III points in the right direction, with higher but less cyclically-varying capital requirements.