The associations of gestational weight gain (GWG) with infant morbidity and mortality are unclear, and the existing recommendations for GWG have not been stratified by the severity of obesity. To identify optimal GWG ranges associated with reduced risks of infant morbidity and mortality across maternal body mass index (BMI) categories. This retrospective cohort study used US nationwide, linked birth and infant death data between 2011 and 2015 to assess the associations of GWG in 2.0-kg groups with infant morbidity and mortality and identified optimal GWG ranges associated with reduced risks of both outcomes, using multivariable logistic regression models. Statistical analysis was performed from February 11 to October 14, 2021. Gestational weight gain equivalent to 40 weeks. The 2 main outcomes were (1) significant morbidity of the newborn infant, defined as any presence of assisted ventilation, admission to the neonatal intensive care unit, surfactant therapy, antibiotic therapy, or seizures; and (2) infant mortality younger than 1 year of age (<1 hour, 1-23 hours, 1-6 days, 7-27 days, or 28-365 days after birth). In this study of 15 759 945 mother-infant dyads, the mean (SD) age of the women was 28.1 (5.9) years. Women gained a mean (SD) of 14.1 (7.3) kg during pregnancy, and the mean (SD) GWG decreased with BMI categories (underweight, 15.7 [6.4] kg; normal weight, 15.4 [6.2] kg; overweight, 14.2 [7.4] kg; obesity class 1, 12.2 [8.0] kg; obesity class 2, 10.3 [8.4] kg; obesity class 3, 8.2 [9.2] kg; P < .001). A total of 8.8% of the newborns experienced significant morbidity, with the lowest prevalence among infants delivered by women in the normal weight BMI class (8.0%) and the highest among infants delivered by women with class 3 obesity (12.4%); 0.34% of infants died within 1 year of birth, with the lowest prevalence among infants delivered by women in the normal weight BMI class (0.28%) and the highest among infants delivered by women with class 3 obesity (0.58%). Optimal GWG ranges were 12.0 to less than 24.0 kg for underweight and normal weight women, 10.0 to less than 20.0 kg for overweight women, 8.0 to less than 16.0 kg for women with class 1 obesity, 6.0 to less than 16.0 kg for class 2 obesity, and 6.0 to less than 10.0 kg for class 3 obesity. The lower bounds of the optimal GWG ranges appeared to be higher than the existing recommendations for overweight women (10.0 vs 7.0 kg) and for those with class 1 (8.0 vs 5.0 kg), class 2 (6.0 vs 5.0 kg), and class 3 (6.0 vs 5.0 kg) obesity. This study analyzed the associations of GWG with infant morbidity and mortality across BMI categories and found that inadequate GWG was associated with increased risks of adverse infant outcomes even for women with obesity. The results suggested that weight maintenance or weight loss should not be used as routine guidelines.