This study examined the relationship between household environments and trajectories of cognitive function among middle-aged and older adults in China and its urban/rural, gender, and age variations. We estimated multi-level linear growth curve models using a representative sample of 16,111 respondents aged 45 years and over from the China Health and Retirement Longitudinal Study (2011–2018). Older people who lived with a spouse, but not with children, and those with higher living expenditures, better housing quality, and indoor clean fuels for cooking had a slower cognitive decline. Living arrangement more strongly predicted men's cognitive decline, while living expenditure, solid fuel use, and housing quality significantly predicted only women's cognitive decline. Only for older adults and rural residents, those living alone had significantly faster cognitive decline than those living with a spouse only. These findings underscore the importance of improving the living conditions of older adults to help alleviate their cognitive decline.