Background: We aimed to evaluate and improve the accuracy of the ultrasound scan in estimating gestational age in late pregnancy (ie, after 24 weeks' gestation) in low-income and middle-income countries (LMICs), where access to ultrasound in the first half of pregnancy is rare and where intrauterine growth restriction is prevalent. Methods: This prospective, population-based, cohort study was done in three LMICs (Bangladesh, Pakistan, and Tanzania) participating in the WHO Alliance for Maternal and Newborn Health Improvement study. Women carrying a live singleton fetus dated by crown-rump length (CRL) measurements between 8+0–14+6 weeks of gestation, who were willing to return for two additional ultrasound scans, and who planned on delivering in the study area were enrolled in the study. Participants underwent ultrasonography at 24+0–29+6 weeks and at 30+0–36+6 weeks' gestation. Birthweights were measured within 72 h of birth, and the proportions of infants who had a small-for-gestational-age birthweight (ie, a birthweight <10% of the standard birthweight for the infant's gestational age and sex according to the INTERGROWTH-21st project newborn baby reference standards) and appropriate-for-gestational-age birthweights were ascertained. Estimation of gestational age by standard fetal biometry measurements in addition to transcerebellar diameter (TCD) measurements was compared with gold-standard CRL measurements by use of Bland-Altman plots to calculate the mean difference and 95% limits of agreement. Statistical modelling was done to develop new gestational age prediction formulas for third trimester ultrasonography in LMICs. Findings: Between Feb 7, 2015, and Jan 9, 2017, 1947 women were enrolled in the study. 1387 pregnant women had an ultrasound scan at 24+0–29+6 weeks of gestation and 1403 had an ultrasound scan between 30+0–36+6 weeks of gestation. Of the 1379 unique infants whose birthweights were available, 981 (71·1%) infants were born with an appropriate-for-gestational-age birthweight and 398 (28·9%) infants were born with a small-for-gestational-age birthweight. The accuracy of late pregnancy ultrasound biometry using existing formulas to estimate gestational age in LMICs was similar to that in high-income settings. With standard dating formulas, late pregnancy ultrasound at 24+0–29+6 weeks' gestation was accurate to within approximately plus or minus 2 weeks of the gold-standard CRL measurement of gestational age, and late pregnancy ultrasound was accurate to within ±3 weeks of the CRL measurement at 30+0–36+6 weeks' gestation. In infants who were ultimately born small for gestational age, individual parameters systematically underestimated gestational age, apart from TCD, which showed minimal bias. By use of a novel parsimonious model formula that combined TCD with femur length, gestational age at the 24+0 −29+6-week ultrasound scan was estimated to within ±10·5 days of the CRL measurement and estimated to within ±15·1 days of the CRL measurement at the 30+0–36+6-week ultrasound scan. Similar results were observed in infants who were small-for-gestational-age. Interpretation: Incorporation of TCD and the use of new formulas in late pregnancy ultrasound scans could improve the accuracy of gestational age estimation in both appropriate-for-gestational-age and small-for-gestational-age infants in LMICs. Given the high rates of small-for-gestational-age infants in LMICs, these results might be especially relevant. Validation of this new formula in other LMIC populations is needed to establish whether the accuracy of the late pregnancy ultrasound can be narrowed to within approximately 2 weeks. Funding: Bill & Melinda Gates Foundation.