Objective: The optimal range of gestational weight gain (GWG) was recently raised in Japan. Considering that the effect of GWG on birth weight varies by quantile, this study performed hypothetical experiments to determine effective GWG advice to reduce small-for-gestational-age (SGA) infants while limiting the increase in large-for-gestational-age (LGA) infants. Design: Retrospective cohort study. Setting: The Japanese Society of Obstetrics and Gynecology nationwide perinatal database, 2013–2017. Population: A cohort of 354,401 primiparous singleton pregnancies. Methods: The association between GWG and birth weight for gestational age was analyzed using a quantile regression model. Based on the results, we estimated how hypothetical strategies targeting women of inadequate or excessive GWG might influence the proportions of SGA and LGA compared with a body mass index (BMI)-based uniform strategy. Main outcome measure: Birth weight for gestational age. Results: The estimated proportions of SGA and LGA in the study population were 9.33 and 11.13, respectively, whereas those in the BMI-based uniform strategy, which assumed a 3-kg increase in GWG for women with BMI < 25 kg/m 2, were 7.26 (95% confidence interval: 7.15–7.36) and 14.51 (14.37–14.66). By contrast, assuming a 3-kg increase and a 3-kg decrease in women with inadequate and excessive GWG, the estimated proportions of SGA and LGA were 8.42 (8.31–8.54) and 11.50 (11.37–11.62), respectively. Conclusions: When providing GWG advice, not only increasing GWG according to prepregnancy BMI, but also determining GWG adequacy and decreasing it when excessive GWG is observed, may be effective for optimizing birth outcomes.