BACKGROUND: The impact of degree of prematurity at birth on premature infant gut microbiota has not been extensively studied in comparison to term infants in large cohorts. METHODS: To determine the effect of gestational age at birth and postnatal exposures on gut bacterial colonization in infants, we analyzed 65 stool samples from 17 premature infants in the neonatal intensive care unit, as well as 13 samples from 13 mostly moderate-to-late premature infants and 189 samples from 176 term infants in the New Hampshire Birth Cohort Study. Gut colonization patterns were determined with 16S rDNA microbiome profiling. RESULTS: Gut bacterial alpha-diversity differed between premature and term infants at 6 weeks of age, after adjusting for exposures (p?=?0.027). Alpha-diversity varied between extremely premature (<28 weeks gestation) and very premature infants (?28 but?<32 weeks, p?=?0.011), as well as between extremely and moderate-to-late premature infants (?32 and?<37 weeks, p?=?0.004). Newborn antibiotic use among premature infants was associated with lower Bifidobacterium and Bacteroides abundance (p?=?0.015 and p?=?0.041). CONCLUSION: Gestational age at birth and early antibiotic exposure have significant effects on the premature infant gut microbiota.