Ingredients
3 tablespoons unsalted butter, plus more, softened, for dish
8 ounces shallots (about 4), thinly sliced (1 1/3 cups)
1 clove garlic, minced
2 thyme sprigs, plus 1 teaspoon leaves
2 1/2 pounds Yukon Gold potatoes, peeled and cut into 1/8-inch-thick rounds
2 cups whole milk
1 cup heavy cream
Kosher salt and freshly ground pepper
5 ounces sharp white cheddar, grated (about 1 1/2 cups)
Preparation
Preheat oven to 325°F with a rack in lower third. Brush a 2-to-2 1/2- quart baking dish with butter. Melt 1 tablespoon butter in a large saucepan over medium heat. Add shallots, garlic, and thyme sprigs; cook, stirring occasionally, until shallots are beginning to turn golden, 5 to 7 minutes (if they brown quickly, reduce heat). Stir in potatoes, milk, cream, and 1 1/2 teaspoons salt. Bring to a boil, then reduce heat to medium-low, cover, and simmer until potatoes are easily pierced with the tip of a knife, about 3 minutes. Remove and discard thyme.
Using a slotted spoon, transfer one-third of potato mixture to prepared dish. Season with salt and pepper; sprinkle with one-third of cheese. Repeat layering once more; top with remaining potato mixture and season. Cut remaining 2 tablespoons butter into cubes; sprinkle over top. Carefully pour liquid from pan over top. Scatter on remaining cheese, thyme leaves, and more pepper. Transfer dish to a parchment-lined rimmed baking sheet.
Bake until bubbly, 1 hour, 20 minutes to 1 1/2 hours. Let cool at least 20 minutes (so cream mixture can be fully absorbed), loosely tented with foil, before serving.