Bring a large pot of salted water to a boil. Heat 2 tablespoons of the oil in a medium saucepan over medium heat. Add the garlic and red pepper flakes and cook, stirring, until the garlic is golden, about 2 minutes. Add both cans of the tomatoes and 1 cup of water. Increase the heat to medium-high and bring to a simmer. Reduce the heat slightly, add the basil sprigs and simmer rapidly, uncovered, until thickened, 15 to 20 minutes. Discard basil and stir in the chopped basil and parsley. Season with salt and pepper.
While the sauce simmers, heat the remaining 2 tablespoons oil in a large skillet over medium-high heat. Add the mushrooms and 1/4 teaspoon salt and cook, stirring occasionally, until golden brown, 6 to 8 minutes. Add the pepperoni and cook, stirring occasionally, until it starts to crisp, about 2 minutes. Transfer to a large bowl.
Cook the ziti in the salted boiling water until very al dente, about 2 minutes less than the package directions instructs. Drain the pasta and add it to the large bowl.
Add the tomato sauce, half each of the mozzarella and the Pecorino to the bowl and stir well to combine. Transfer the pasta-mushroom mixture to a 3- to 4-quart baking dish and top with the remaining mozzarella and Pecorino. Bake, uncovered, until browned, about 15 minutes. Let the pasta rest about 10 minutes before serving.
Copyright 2016 Television Food Network, G.P. All rights reserved.