Optimal nutrition is important after preterm birth to facilitate normal brain development. Human milk is rich in sialic acid and preterm infants may benefit from supplementing formula with sialyllactose to support neurodevelopment. Using pigs as models, we hypothesized that sialyllactose supplementation improves brain development after preterm birth. Pigs (of either sex) were delivered by cesarean section at 90% gestation and fed a milk diet supplemented with either an oligosaccharide-enriched whey with sialyllactose (n = 20) or lactose (n = 20) for 19 days. Cognitive performance was tested in a spatial T-maze. Brains were collected for ex vivo magnetic resonance imaging (MRI), gene expression, and sialic acid measurements. For reference, term piglets (n = 14) were artificially reared under identical conditions and compared with vaginally born piglets naturally reared by the sow (n = 12). A higher proportion of sialyllactose supplemented preterm pigs reached the T-maze learning criteria relative to control preterm pigs (p < 0.05), and approximated the cognition level of term reference pigs (p < 0.01). Furthermore, supplemented pigs had upregulated genes related to sialic acid metabolism, myelination, and ganglioside biosynthesis in hippocampus. Sialyllactose supplementation did not lead to higher levels of sialic acid in the hippocampus or change MRI endpoints. Contrary, these parameters were strongly influenced by postconceptional age and postnatal rearing conditions. In conclusion, oligosaccharide-enriched whey with sialyllactose improved spatial cognition, with effects on hippocampal genes related to sialic acid metabolism, myelination, and ganglioside biosynthesis in preterm pigs. Dietary sialic acid enrichment may improve brain development in infants.