An asset bubble relaxes collateral constraints and increases borrowing by credit-constrained agents. At the same time, as the bubble deflates when constraints start binding, it amplifies downturns. We show analytically and quantitatively that the macroprudential policy should optimally respond...