Preheat your oven to 375°F (190°C) and grease a 9x13-inch baking dish.
In a saucepan over medium heat, melt the butter. Add the flour and whisk constantly for about 1-2 minutes to create a light roux.
Gradually pour in the milk while continuing to whisk. Cook and stir until the mixture thickens and comes to a gentle simmer.
Remove the saucepan from heat and stir in half of the shredded cheddar cheese until melted. Add garlic powder, onion powder, salt, and black pepper, and mix well.
Layer half of the sliced potatoes in the prepared baking dish, overlapping slightly. Pour half of the cheese sauce over the potatoes.
Layer the remaining potatoes on top, followed by the rest of the cheese sauce.
Sprinkle the remaining shredded cheddar cheese over the top of the potatoes.
Cover the baking dish with aluminum foil and bake for 45 minutes.
Remove the foil and bake for an additional 15-20 minutes, or until the potatoes are tender and the top is golden brown.
Once out of the oven, let the au gratin potatoes rest for a few minutes before serving.
Serve warm and enjoy!