People face various income risks, including events such as job loss and illness – some of which are foreseeable while others are not. Understanding how and when people can mitigate and avoid the cost of these events is of fundamental importance to public insurance. However, empirical evidence is limited due to difficulties in measuring risks and the choices people make to avoid them, compounded by challenges in separating adverse selection from causation in the data. In this paper, we make two contributions toward filling this gap. First, we offer causal evidence on layoff costs and anticipatory responses using quasi-experimental variation in firm closures in Norway. The key to our empirical approach is that bankruptcy judges are randomly assigned and vary in how often they liquidate the firm. Combined with administrative records tracking job changes, wealth, and income, we show that layoff causes a persistent decline in employment and income. However, average impacts mask important heterogeneity. About 50% of non-treated workers escape layoff risk in normal times by leaving their distressed (but surviving) firm. In contrast, we find liquidation causes a large impact on earnings and income in recession years – suggesting that fewer employment opportunities drive the layoff costs. Our second contribution is to build a model where people face aggregate and idiosyncratic layoff risk and make precautionary savings and job search decisions based on their available information. We calibrate the model to fit the causal evidence and use it to quantify how on-the-job search interacts with public and private insurance and shapes the disparate effects of job loss over the business cycle.