BackgroundEpisodic memory naturally deteriorates with age, and its deficits are widely recognized as the most significant feature and the most sensitive indicator of cognitive decline. It has been suggested that adopting a healthy lifestyle can play a protective role in preserving episodic memory. This study aimed to systematically examine the relationship between lifestyle factors (social activities, leisure activities, physical activities, internet use, smoking, alcohol drinking, and sleep quality) and episodic memory in middle-aged and older adults.MethodsThe current study included 10,392 participants from the Chinese Health and Retirement Longitudinal Survey. A linear mixed model was used to explore the associations between lifestyle factors and episodic memory performance and the age- and sex-specific effects of the association.ResultsLow-frequency alcohol drinking, higher engagement in social, leisure, and physical activities, increased internet use, and improved sleep quality were associated with better episodic memory performance in middle-aged and older adults. Stratified analyses demonstrated that internet use significantly correlated with episodic memory performance in middle-aged adults but not in older adults. On the other hand, sleep quality showed a significant association with episodic memory performance in women but not in men.ConclusionsThis study highlights the association between various lifestyle factors and episodic memory performance, with variations observed based on age and sex. Adopting healthy lifestyle factors can have positive effects on episodic memory in middle-aged adults, emphasizing the importance of adhering to healthy lifestyles from middle age onwards to counteract episodic memory decline.