The adverse psychological and social impacts of COVID-19 pandemic are well characterized, but the role of composite, modifiable lifestyle factors that may interact to mitigate these impacts is not. The effect of socioeconomic deprivation on these lifestyle risks also remains unclear. Based on a nationally representative, longitudinal cohort, we assessed the association between a combination of pre-pandemic lifestyle factors and mental health conditions during pandemic, and the contribution of deprivation to it. Composite lifestyle factors included BMI, smoking status, alcohol consumption, physical activity, sedentary time, sleep duration, and fruit and vegetable intake, with lifestyle scores and lifestyle categories calculated for each participant. Symptoms of depression and anxiety, and personal well-being were assessed by validated scales during the pandemic. Socioeconomic deprivation was characterized by both individual-level (income, wealth, and education) and group-level factors (Index of Multiple Deprivation). Of the 5049 eligible participants (mean [SD] age, 68.1 [10.9] years; 57.2% were female) included in the study, 41.6% followed a favorable lifestyle, 48.9% followed an intermediate lifestyle, and 9.5% followed an unfavorable lifestyle. Compared with favorable lifestyle category, participants in the intermediate and unfavorable lifestyle category were at increased risk of mental health conditions, with the hazard ratio (HR) for trend per increment change towards unfavorable category of 1.17 (95% CI 1.09–1.26) for depression, 1.23 (1.07–1.42) for anxiety, and 1.39 (1.20–1.61) for low well-being. A significant trend of lower risk for mental health conditions with increasing number of healthy lifestyle factors was observed (P < 0.001 for trend). There were no significant interactions between lifestyle factors and socioeconomic deprivation for any of the outcomes, with similar HRs for trend per one increment change in lifestyle category observed in each deprivation group. Compared with those in the least deprived group with favorable lifestyle, participants in the most deprived group adherent to unfavorable lifestyle had the highest risk of mental health outcomes. These results suggest that adherence to a broad combination of healthy lifestyle factors was associated with a significantly reduced risk of mental health conditions during the COVID-19 pandemic. Lifestyle factors, in conjunction with socioeconomic deprivation, independently contribute to the risk of mental health issues. Although further research is needed to assess causality, the current findings support public health strategies and individual-level interventions that provide enhanced support in areas of deprivation and target multiple lifestyle factors to reduce health inequalities and promote mental well-being during the ongoing COVID-19 pandemic.