Preheat the oven to 400 degrees F and lightly coat a 9 x 13-inch baking dish with cooking spray.
Cut the sweet potatoes into large cubes and toss with 2 tablespoons of the olive oil, the salt, and the pepper. Transfer to the baking dish and roast for 30 minutes.
Meanwhile, in a large skillet, heat the remaining oil over medium heat. Add the onion and garlic and sauté for 5 minutes. Add the sausage and break apart with a wooden spoon until cooked.
Add the sausage to the sweet potatoes and top with the Parmesan and pepper flakes, if using. Bake for another 15 minutes. Serve.