Warm the milk in a saucepan over medium heat just until it begins to simmer.
Meanwhile, in a separate bowl, vigorously whisk together the sugar, egg yolks, and cornstarch until the mixture turns pale and thickened.
Gradually stream the hot milk into the egg mixture while constantly whisking to temper the eggs. Return the blended mixture to the saucepan.
Cook over medium heat, stirring continuously, until the custard thickens (approximately 2–3 minutes).
Remove from the heat, stir in the butter and vanilla extract, and transfer to a bowl. Press a layer of plastic wrap directly onto the surface to prevent a skin from forming. Refrigerate for 1 hour until thoroughly chilled.