This paper develops an analytical framework to study consumption and labour supply in a rich class of heterogeneous-agent economies with partial insurance. The environment allows for trade in non-contingent and state-contingent bonds, for permanent and transitory idiosyncratic productivity shocks, and for permanent preference heterogeneity and idiosyncratic preference shocks. Exact closed-form solutions are obtained for equilibrium allocations and for the first and second moments of the equilibrium joint distribution over wages, hours and consumption. With these expressions in hand, we show that all the structural preference and risk parameters in the model can be identified, even when productivity risk varies over time, given panel data on wages and hours, and cross-sectional data on consumption. We estimate the model on CEX and PSID data for the U.S. economy over the period 1967-1996. We then use the estimated parameter values to decompose inequality in all variables of interest, both over the life-cycle and across time, into cross-sectional variation in preferences, uninsurable wage risk, insurable wage risk, and measurement error.