A casserole will last in the fridge for up to 4 to 5 days as long as you keep the casserole covered and refrigerated constantly when not eating the casserole.
You can keep the casserole longer than 4 to 5 days by freezing the casserole since the freezing will prevent bacteria and mold from growing on the casserole dish.
If you freeze the casserole instead of just refrigerating the casserole then the frozen casserole will last from 6 months to a year before it starts to go bad.
If you're not eating the casserole within 4 days you should freeze it immediately instead of keeping it in the refrigerator so that it can last longer.
I always freeze any leftover foods such as casserole if not eating the food or casserole within 4 days so that it makes it last longer.