Preheat your oven: Set your oven to 350°F (175°C) and prepare a 9x13-inch baking dish by spraying it with nonstick spray.
Prepare the potato mixture: In a large bowl, combine 32 oz thawed frozen cubed hash browns, ¼ cup melted unsalted butter, 2 cups shredded sharp cheddar cheese, and 1 ½ cups sour cream. Mix well until all ingredients are evenly combined. Set aside.
Make the sauce: In a medium skillet over medium heat, melt ¼ cup unsalted butter. Add 1 diced small yellow onion and cook until softened, about 4-5 minutes. Stir in 2 tsp minced garlic and cook for an additional 1 minute. Sprinkle in ¼ cup all-purpose flour, 1 tsp kosher salt, ½ tsp black pepper, ½ tsp cayenne pepper, and ½ tsp dried mustard, stirring to combine.
Add liquids to the sauce: Gradually whisk in ½ cup chicken broth and ½ cup whole milk until the mixture thickens, about 2-3 minutes. You want a velvety consistency that clings to the back of a spoon.
Combine the sauce and potatoes: Pour the warm sauce into the bowl with the potato mixture and stir until everything is combined evenly. Transfer the mixture to the prepared baking dish and spread it evenly.
Bake the casserole: Place the dish in the preheated oven and bake for 45-50 minutes, or until the casserole is bubbly and golden on top.
Fry the onions: While the casserole is baking, heat 4 cups vegetable oil in a large pot or deep skillet over medium-high heat. Carefully add 2 thinly sliced large yellow onions and fry until they reach a deep golden brown, stirring occasionally, for about 10-15 minutes. Remove the fried onions from the oil and let them drain on paper towels, then sprinkle with ½ tsp kosher salt.
Top off your casserole: Once the casserole is baked, take it out of the oven and sprinkle the fried onions generously over the top. Return to the oven for an additional 5-10 minutes to allow the onions to crisp further and meld with the casserole.
Serve hot: Allow the casserole to cool slightly before serving. Enjoy this dish warm for the ultimate comfort food experience!