Background Substantial breastfeeding disparities exist among various ethnic and racial groups, and between mainland Chinese immigrants and native born Chinese women. However, few studies have addressed the effect of migration on mainland Chinese immigrants or the effect of time since migration on breastfeeding practices. Hong Kong, SAR, China, provides a unique opportunity since immigrants are from one country and share the same race and ethnic origin. Thus, the aim of this study was to examine the effect of time since migration on the breastfeeding practices of native Hong Kong-born and mainland Chinese immigrant mothers in Hong Kong. Methods Mother–infant pairs were recruited during postnatal hospitalisation at four geographically distributed public hospitals in Hong Kong over two time periods. The first cohort was recruited from June 20, 2006 to July 11, 2007 and the second cohort was recruited from October 11, 2011 to May 31, 2012. Participants were Cantonese-speaking, Hong Kong residents; gave birth to a full-term, singleton infant; intended to breastfeed; and had no serious medical or obstetric complications. Exclusion criteria were admission to the special care nursery for more than 48 hours after birth or admission to the neonatal intensive care unit. Data were collected directly from participants during postnatal hospitalisation and after discharge by telephone. In-hospital data collection included basic demographic details, maternal and infant data, and in-hospital feeding data. Follow-up data included infant feeding status at 1, 2, 3, 6, 9 and 12 months postpartum or until breastfeeding was stopped. Participants were asked how long they had lived in Hong Kong and data were grouped into four categories: less than 5 years, 5–15 years, more than 15 years, and since birth. The primary outcome was the duration of any and exclusive breastfeeding up to twelve months postpartum. The study was approved by the Institutional Review Board of the University of Hong Kong and Hospital Authority Hong Kong West Cluster, and from all study hospitals. Informed written consent was obtained from each participant. Findings We recruited a total of 2704 mother–infant pairs (cohort 1, 1417; cohort 2, 1287). We excluded 217 patients after recruitment: 20 participants had a newborn transferred to the neonatal intensive care unit, 124 participants were not contactable for follow-up, 21 participants were not born in either Hong Kong or mainland China, and 52 participants had missing data. Of the remaining 2487 participants, 2419 (97·3%) completed follow-up to 12 months and 68 (2·7%) had partial follow-up. A Kaplan-Meier survival curve showed that a longer time from migration was associated with progressively shorter durations of any and exclusive breastfeeding. After adjustment for potential confounders, the relationship between length of migration and breastfeeding duration was attenuated somewhat but the pattern remained. When compared with mothers who had lived in Hong Kong for less than 5 years, Hong Kong-born participants were 34% more likely to stop any breastfeeding (HR 1·34; 95% CI 1·10–1·63) and 33% more likely to stop exclusive breastfeeding (HR 1·33; 95% CI 1·11–1·58) within 12 months. Interpretation We found that mainland Chinese immigrants were more likely to breastfeed for longer than mothers born in Hong Kong. However, as length of residence in Hong Kong increases, breastfeeding duration decreases in a dose-response pattern. Practitioners can assess the migration patterns of pregnant women and provide culturally adapted breastfeeding support and encouragement to this population. Future research is needed to identify the specific factors associated with migration that affect breastfeeding practices. Funding The Health and Medical Research Fund and the Food and Health Bureau of the Hong Kong Government.