This paper analyses the relationship between working from home (WFH) and mental well-being at different stages during the first two critical years of the COVID-19 pandemic, when governments repeatedly imposed lockdowns and enacted WFH mandates to contain the spread of the virus. Using data from a representative survey conducted at four different time periods in 2020 (first lockdown, subsequent gradual reopening), 2021 (further lockdown) and 2022 (restrictions widely lifted) in the 27 EU member states, it examines the changing role of several mediators over time: work-family conflict, family-work conflict, stability, resilience, isolation, the importance of different support networks, workload, physical risk of contracting COVID-19 at work and housing conditions. For the first lockdown, it also differentiates by previous WFH experience, in terms of WFH novices and experienced WFH workers. It likewise differentiates by gender, in order to take the potential gendered nature of COVID-19 measures into account. The results point to several important mediators: for those who work from home, less family-work conflict and isolation, but greater stability, resilience, network support from family and friends, and superior housing conditions were associated with better mental well-being. The relevance of mediators was specific to certain stages of the pandemic. Stability was the most important mediator during the first lockdown. Work-family conflict and family-work conflict were only relevant during the first lockdown, while resilience and isolation mattered especially towards the end of the pandemic. Unlike established WFH workers, WFH novices had an advantage during the first lockdown, benefiting from lower family-work conflict and more helpful networks of family and friends. Our results differ by gender: for females who undertook WFH, important mediators were work-family conflict and family-work conflict. Both were related to adjustments they had to make in work and non-work hours in response to the enforced closure of schools and childcare facilities. For males who undertook WFH, support from networks of family and friends was an important mediator during the first lockdown.