Melt butter in a large skillet over medium-high; sauté mushrooms and onions about 10-12 minutes until golden and moisture evaporates. Season with salt and pepper; cool completely.
Grease a 9x13-inch dish; spread cooled mushroom mixture evenly in bottom.
Whisk eggs, milk, garlic powder, salt, and pepper in a large bowl until combined; stir in Gruyere.
Pour over mushrooms and onions; cover tightly with plastic wrap and refrigerate overnight.
Next morning, preheat oven to 350°F; remove casserole from refrigerator while oven heats.
Bake uncovered 35-40 minutes until center is set and top golden brown; sprinkle with parsley before serving.