In Brief Purpose Increasing retirement-aged workers are encouraged to stay in the labor market, as delayed retirement initiative is proposed. This study investigates the interplay of late-life working participation and social security on the mental health risk of retirement-aged workers. Method We applied data from the China Health and Retirement Longitudinal Study (CHARLS-2018), and the instrumental variables regression was conducted. Results Late-life working could alleviate depression, as did the beneficiary status of employment-based social health insurance and the pensionable phase of social pension participation. Besides, the role of late-life working in alleviating depression became more salient when late retirees were not insured by the employment-based social health insurance and still in the pension contribution phase. Conclusions It is suggested that the current social security system in China has not been sufficiently well designed to protect the mental health of retirement-aged workers. Social security (employment-based health insurance and pension) is critical to protect mental health of retirement-aged workers. It is essential to improve the design of social security system in order to protect this vulnerable group.