Preheat Oven and Prepare Dish:
Preheat your oven to 375°F (190°C). Grease a 9x13-inch baking dish with butter or non-stick cooking spray.
Prepare the Cream Sauce:
In a medium saucepan, melt the butter over medium heat. Add the minced garlic and cook until fragrant (about 1 minute). Stir in the flour and whisk constantly for 1–2 minutes to form a roux.
Add Milk and Cream:
Gradually pour in the milk and heavy cream while whisking to prevent lumps. Cook for 3–4 minutes until the mixture thickens. Stir in salt, pepper, and thyme (if using). Remove from heat.
Layer the Potatoes:
Arrange half of the sliced potatoes in the prepared baking dish, slightly overlapping. Pour half of the cream sauce over the potatoes, spreading evenly. Sprinkle with half of the cheddar and Parmesan cheese.
Repeat Layers:
Add the remaining potato slices in an even layer. Pour the rest of the cream sauce on top and sprinkle with the remaining cheeses.
Bake:
Cover the dish with aluminum foil and bake for 40 minutes. Remove the foil and bake for an additional 20–25 minutes, or until the potatoes are tender and the top is golden and bubbly.
Cool and Serve:
Let the scalloped potatoes cool for 5–10 minutes before serving. Garnish with fresh thyme or parsley if desired.