We document the cyclical properties of the balance sheets of different types of intermediaries. While the leverage of the bank sector is highly procyclical, the leverage of the nonbank financial sector is acyclical. We propose a theory of a two-agent financial intermediary sector within a dynamic model of the macroeconomy. Banks are financed by issuing risky debt to households and face risk-based capital constraints, which leads to procyclical leverage. Households can also participate in financial markets by investing in a nonbank 'fund' sector where fund managers face skin-in-the-game constraints, leading to acyclical leverage in equilibrium. The model also reproduces the empirical feature that the banking sector's leverage growth leads the financial sector's asset growth, while leverage in the fund sector does not precede growth in financialsector assets. The procyclicality of the banking sector is due to its risk-based funding constraints, which give a central role to the time variation of endogenous uncertainty.