This study determined the effect of dietary energy allowance during gestation on reproductive performance, blood metabolites, and milk composition in primiparous sows. Forty-four Landrace×Yorkshire gilts were randomly assigned to receive one of four dietary energy allowances (n=11): low (L), medium (M), high (H), and extremely high (EH). The gilts in L, M, H, and EH treatments were provided 75, 100, 125, and 150% of the energy requirement for maintenance from 0 to 30 d of gestation, respectively. Compared to d 0–30 of gestation, dietary energy allowances in each group increased by 20% from d 30–90 of gestation and increased by 50% from d 90 of gestation to parturition. After parturition, all primiparous sows received the same diet and fed ad libitum during lactation. The results showed that dietary energy linearly and quadratically increased (P<0.01) sow body weight and backfat thickness at d 0 and 28 of lactation. Dietary energy linearly and quadratically increased (P<0.01) sow body weight gain and backfat gain from d 0 of gestation to d 0 of lactation. With increasing dietary energy allowance, there were linear and quadratic increases (P<0.01) in sow body weight loss and backfat loss during lactation, and linear and quadratic decreases (P<0.01) in average daily feed intake during lactation. However, with increasing dietary energy allowance, individual birth and weaning weight linearly and quadratically increased (P<0.05), and litter weight quadratically increased at birth (P<0.05) and tended to increase at weaning (quadratic, P=0.06). The greatest litter weight at birth and weaning was observed when sows were provided the H energy allowance. The number of total born and born alive was not influenced by dietary energy. With increasing dietary energy allowance, the fat and protein content linearly and quadratically increased (P<0.01) in colostrum, and the fat and protein content quadratically increased (P=0.01) in mature milk. The greatest fat and protein content in mature milk was observed when sows were provided the H energy allowance. The results indicated that providing 125, 150, and 187.5% of the energy requirement for maintenance during early, mid, and late gestation was beneficial in maintaining optimal body condition of primiparous sows, as well as improving piglet growth performance and milk fat and protein output.