Ingredients

3 tablespoons extra-virgin olive oil, plus more for drizzling

3 pints red, orange, and yellow pear or cherry tomatoes (about 2 pounds), halved if large; plus a few more, still on the vine (optional)

Kosher salt

2 cloves garlic, minced

Large pinch of red-pepper flakes, plus more for serving

12 ounces spaghetti or bucatini

2 ounces Parmigiano-Reggiano, finely grated (1/2 cup)

1/2 cup fresh ricotta cheese

Small fresh basil leaves, for serving

Preparation

If you aren’t using any tomatoes on vine, skip to step 2. Otherwise, heat 1 tablespoon oil in a large skillet over medium. Add tomatoes on vine, season with salt, and cook, gently stirring, until skins begin to pucker, about 3 minutes, depending on size. Transfer to a plate.

Heat remaining 2 tablespoons oil in skillet over medium-high. Add garlic and remaining tomatoes and cook, stirring occasionally, until tomatoes are just beginning to break down, 3 to 5 minutes. Add red-pepper flakes and season with salt. Remove from heat.

Meanwhile, cook pasta in a large pot of salted boiling water 1 minute less than package directions. Reserve 1 cup pasta water, then drain pasta and return to pot. Add 1/3 cup pasta water, tomato mixture, and Parmigiano.

Cook over medium heat, tossing, until pasta is evenly coated, about 2 minutes, adding more pasta water as needed. To serve, top pasta with ricotta and sautéed tomatoes on the vine (if using); drizzle pasta with oil, then sprinkle with more red-pepper flakes and basil.