Preheat oven to 375°F and position rack in the upper third.
In a medium bowl, mix cream cheese, ricotta, Parmesan, garlic powder, and oregano until smooth. Set aside.
Boil a large pot of salted water. Cook spaghetti 2 minutes less than package directions. Drain and return to pot.
In a skillet over medium-high heat, cook sausage and chopped onion until browned and cooked through, about 10 minutes.
Add garlic and red pepper flakes to skillet, cook for 1 minute. Drain excess fat from pan.
Combine sausage mixture, cooked spaghetti, and marinara sauce in the pot. Toss to coat evenly.
Spread half of the pasta mixture evenly into the baking dish.
Spread the cheese layer over the pasta layer evenly, even if messy.
Add remaining pasta mixture on top and spread evenly. Sprinkle mozzarella over the top.
Cover casserole with foil and bake for 30 minutes.
Remove foil and broil for a few minutes until cheese is bubbly and browned. Watch closely.
Let sit 5-10 minutes before cutting into portions. Season with salt and pepper as desired.