In western industrialised countries, about 30% of health-care expenditure of retired people is incurred by individuals in their last year of life. The corresponding high costs of dying have led medical philosophers to ask for a rationing of health-care services according to age. By contrast, this paper pursues an individualistic approach. High costs of dying are identified as a consequence of moral hazard on both the demand and supply side of the health-care sector. Health insurance prevents demand for health-care services from decreasing when an individual's residual life expectancy shrinks. Age-related moral hazard can be limited by a coinsurance scheme with a deductible that increases with the age of the insured. Given the high costs of dying, the optimal insurance policy links the coinsurance rate to the age-specific mortality risk.