01 -
Preheat oven to 350°F. Coat a 9×13-inch baking dish with nonstick spray.
02 -
In a medium skillet over medium heat, melt 1/4 cup unsalted butter. Add diced yellow onion and cook until translucent, about 5 minutes. Stir in minced garlic and cook for 1 minute. Sprinkle in flour and cook, stirring constantly, until golden and fragrant, approximately 2 minutes.
03 -
Gradually whisk in whole milk to the flour mixture. Stir in 1 teaspoon kosher salt, black pepper, and cayenne pepper. Continue cooking until the sauce thickens, about 2 to 3 minutes. Remove from heat and let cool slightly.
04 -
In a large bowl, combine thawed hash browns, shredded sharp cheddar cheese, sour cream, and the melted 1/4 cup butter. Add prepared onion cream sauce. Mix until thoroughly combined.
05 -
Transfer the potato mixture into the prepared baking dish. Smooth the top with a spatula and bake in the preheated oven for 30 to 45 minutes, until golden and bubbling.
06 -
While casserole bakes, heat vegetable oil in a large heavy-bottomed pot to 350°F. Working in batches, fry thinly sliced onions until deep golden brown and crispy, approximately 2 to 3 minutes per batch. Transfer to a paper towel-lined plate and season with kosher salt.
07 -
Remove casserole from oven and immediately top with crispy fried onions. Serve hot.