Preheat oven to 400°F and grease a 9×13-inch dish.
Melt butter in skillet, whisk in flour for 1 min.
Slowly add milk and broth, whisk until thickened.
Add garlic, thyme, salt, pepper; cook 2–3 min.
Layer half the potatoes in dish, then onion, half the sauce, 1 cup cheese.
Repeat layers with remaining ingredients, ending with ½ cup cheese.
Cover and bake 30 min; uncover and bake 35–40 min until tender.
Rest 20 min before serving.
