1. Combine the milk, sugar, and cornstarch in a medium saucepan. Cook over medium heat, stirring constantly, just until the mixture turns hot but not bubbling, about five minutes.
2. Whisk half a cup of the hot mixture into the egg yolks. Pour the egg yolk mixture into the pan and cook, stirring constantly, until the mixture is thick and bubbling, about five minutes.
3. Remove from the heat and stir in the vanilla extract. Strain the custard through a fine-mesh sieve into a bowl, cover with plastic wrap, and leave at room temperature until ready to use (refrigerate if not using within a few hours, up to one week; then gently rewarm in a microwave).