Preheat oven to 375°F (190°C). Spray a 9-inch square baking dish with cooking spray.
Arrange potato slices and onion in the dish, leaving space for slanting slices.
Make the sauce: melt butter, whisk in flour, then gradually add milk and simmer until thickened. Stir in Cheddar, salt, garlic, and pepper.
Pour sauce over potatoes, cover with foil, and bake for 45 minutes.
Remove foil, sprinkle with Gruyère and Parmesan, then bake uncovered until golden, about 30-45 minutes. Broil briefly for extra crispiness if desired. Cool 10 minutes, then garnish with chives and serve.
Notes
For extra crisp topping, broil for 1-2 minutes watching closely.