We present a model with heterogeneous firms, in which credit constraints may give rise to self-fulfilling, sunspot-driven business cycle fluctuations. We derive optimal incentive-compatible loan contracts, under which a firm’s borrowing capacity is constrained by expected equity value. Interactions between debt and equity value made possible by credit constraints generate a credit externality, which leads to procyclical total factor productivity (TFP) and, with sufficiently high cost of financial intermediation, to equilibrium indeterminacy. At the aggregate level, the credit externality is observationally equivalent to production externality. Aggregate dynamics in our model with credit constraints and constant returns technology at the firm level are isomorphic to those in an aggregate economy with increasing returns, such as that studied by Benhabib and Farmer (1994).