Preheat the oven to 375°F. Butter an 8x8-inch or 2-quart baking dish.
Melt the butter in a medium saucepan over medium heat. Add the garlic and cook for 30 seconds. Whisk in the flour and cook for 1 minute.
Slowly pour in the milk, whisking the whole time. Simmer for 3–4 minutes, whisking often, until the sauce coats the back of a spoon.
Take the pan off the heat. Stir in the salt, pepper and 1 cup of the cheese until melted.
Layer half of the potatoes in the dish and pour half of the sauce over them. Repeat with the remaining potatoes and sauce.
Cover tightly with foil and bake for 30 minutes.
Uncover, sprinkle with the remaining ½ cup of cheese and bake for 25–30 minutes more, until the potatoes are tender when pierced with a knife and the top is golden.
Rest for 10 minutes before serving.