Generously spray a 11x8 casserole or 10 inch square dish with cooking spray. Add ½ the bread to the dish, along with ¾ cup of shredded cheese and crumbled sausage or pepperoni (if using) followed by the remaining bread, set aside.
In a medium bowl, combine the eggs, milk, parmesan, basil, sun-dried tomatoes, garlic, salt, pepper, and red pepper flakes and whisk until thoroughly mixed.
Pour the prepared mixture over the bread. Use a wooden spoon to help push the bread down so it soaks up all the liquid. Sprinkle the remaining cheese on top, cover the dish with plastic wrap and refrigerate for at least 8 hours so the bread soaks up the egg mixture.
Position a rack in the center of the oven and preheat the oven to 375ºF. Bake the casserole, uncovered for 35-42 minutes or until the cheese melts and a toothpick inserted in the casserole comes out without any liquid on it. Allow the casserole to cool for 5-10 minute before slicing and serving.