There were an estimated 247 million rural-to-urban migrant workers in China in 2016, yet at a national level, there is scant evidence on the association of migration with mental health among migrants and their left-behind family members. To examine the association of rural-to-urban migration with symptoms of depression among migrants and left-behind family members aged 45 years and older. Using representative cross-sectional data of 14 332 middle-aged and older adults from the 2015 China Health and Retirement Longitudinal Survey, regression analyses were conducted to examine the association of depressive symptoms with rural-to-urban migration status in urban areas and the association of depressive symptoms with left-behind status in rural areas. The statistical analysis was performed from January to August 2018. Migration status (defined as having a rural hukou [household registration record]) in urban areas and left-behind status (defined as having a spouse or child living in another area) in rural areas. Depressive symptoms measured on the 10-item Center for Epidemiological Studies Depression (CES-D-10) scale. A total of 14 332 middle-aged and elderly participants (mean [SD] age, 59.84 [9.51] years; 7394 [51.6%] women) were included, of whom 4404 (30.7%) lived in urban areas and 9928 (69.3%) lived in rural areas. In urban areas, 1607 participants (36.2%) were rural-to-urban migrants, and the remaining 2797 participants (72.8%) were local residents. In rural areas, 3405 participants (34.3%) were left-behind family members, and the remaining 6523 participants (65.7%) were not. Compared with urban residents, rural-to-urban migrants had higher CES-D-10 scores after adjustment for covariates (β = 0.74; 95% CI, 0.08-1.40; P = .03; standard errors clustered at the household level henceforth). Compared with intact-family rural residents, left-behind spouses had higher CES-D-10 scores after adjustment for covariates (β = 0.54; 95% CI, 0.05-1.03; P = .03). Rural-to-urban migration in China was associated with poor mental health for migrants and their left-behind spouses. Short-term policies, such as building community social facilities, may prove effective, but long-term solutions should address issues related to economic and social exclusions and the lack of a social security system in rural China.