In a medium saucepan, whisk together the milk, sugar, and cornstarch until smooth.
Cook over medium heat, stirring constantly, until the mixture thickens and begins to bubble.
In a separate bowl, whisk the egg yolks. Gradually add a small amount of the hot milk mixture to the egg yolks to temper them.
Return the egg mixture to the saucepan, whisking continuously. Cook for another 2-3 minutes until the custard is thick and smooth.
Remove from heat and stir in the vanilla extract and butter.
Transfer the custard to a bowl, cover with plastic wrap (pressed directly onto the surface), and refrigerate until cool.