Preheat oven to 375°F and lightly grease a deep 9x13 casserole dish.
Cook spaghetti to al dente according to package directions. Cook chicken if needed.
In a large sauce pan, melt butter over medium heat. Add the onions and mushrooms and cook until the onions are soft and translucent. About 3-4 minutes.
Add the minced garlic and cook another minute until fragrant.
Stir in the flour, salt and pepper. Cook for another minute.
Slowly stir in the chicken broth, stirring constantly.
Then slowly stir in the milk.
Bring to a low boil and boil until thickened, about 4-5 minutes, stirring often.
Stir in the shredded mozzarella and 1 cup shredded cheddar a little at a time, make sure each addition is melted before adding more.
Then stir in the sour cream.
Pour the sauce over the cooked and drained spaghetti and stir it together.
Stir in the cooked chicken and broccoli.
Add the pasta to the prepared casserole dish.
Top the casserole with the remaining cup of cheddar cheese.
Bake casserole for 25-30 minutes until bubbly and cheese is melted.