Private equity funds are important to the economy, yet there is little analysis explaining their financial structure. In our model the financial structure minimizes agency conflicts between fund managers and investors. Relative to financing each deal separately, raising a fund where the manager receives a fraction of aggregate excess returns reduces incentives to make bad investments. Efficiency is further improved by requiring funds to also use deal-by-deal debt financing, which becomes unavailable in states where internal discipline fails. Private equity investment becomes highly sensitive to aggregate credit conditions and investments in bad states outperform investments in good states.