Preheat the oven to 350°F. Grease a 9×13-inch baking dish and set aside.
In a large saucepan, melt the butter over medium-low heat. Add the diced onion and minced garlic, cooking until the onion softens, about 3 to 4 minutes. Stir in the flour and cook for an additional 2 minutes.
Gradually add the milk and chicken broth, whisking continuously. Start with a small amount of liquid, whisking until the mixture is smooth and thickened before adding more liquid. Continue this process until all the liquid is incorporated.
Increase the heat to medium and bring the mixture to a boil, stirring constantly. Add ½ teaspoon of salt and ⅛ teaspoon of black pepper, and let the mixture boil for 1 minute.
In the prepared baking dish, arrange ⅓ of the potato slices in an even layer. Season with ¼ teaspoon of salt and ⅛ teaspoon of black pepper. Pour ⅓ of the cream sauce over the potatoes.
Repeat the layering process, seasoning with salt and pepper, ending with the remaining sauce on top. Cover the dish tightly with aluminum foil and bake for 45 minutes.
Remove the foil and continue baking for an additional 35-45 minutes, or until the top is golden and the potatoes are tender. For a crispier top, broil for 3-4 minutes if desired.
Allow the dish to rest for at least 15 minutes before serving.