Thanks to Cooks Illustrated for this perfect summer recipe. I’ve made it twice. I’ve doubled the amount of squash and zucchini in one successful baking. I’ve also substituted fresh rosemary for the thyme and, in a really nice twist, substituted Thai basil for Italian basil.
INGREDIENTS
6 tablespoons  extra-virgin olive oil
1 pound  zucchini , ends trimmed and sliced crosswise into 1/4-inch-thick slices (see note)
1 pound  summer squash (yellow), ends trimmed and sliced crosswise into 1/4-inch-thick slices (see note)
2 teaspoons  table salt
1 1/2 pounds  ripe tomatoes (3 to 4 large), sliced 1/4 inch thick
2 medium  onions , halved lengthwise and sliced thin pole to pole (about 3 cups)
3/4 teaspoon  ground black pepper
2 medium  garlic cloves , minced or pressed through garlic press (about 2 teaspoons)
1 tablespoon  minced fresh thyme leaves
1 large slice  white sandwich bread , torn into quarters
2 ounces  Parmesan cheese , grated (about 1 cup)
2 medium  shallots , minced (about 1/4 cup)
1/4 cup  chopped fresh basil leaves
1. Adjust oven rack to upper-middle position and heat oven to 400 degrees. Brush 13- by 9-inch baking dish with 1 tablespoon oil; set aside.

2. Toss zucchini and summer squash slices with 1 teaspoon salt in large bowl; transfer to colander set over bowl. Let stand until zucchini and squash release at least 3 tablespoons of liquid, about 45 minutes. Arrange slices on triple layer paper towels; cover with another triple layer paper towels. Firmly press each slice to remove as much liquid as possible.

3. Place tomato slices in single layer on double layer paper towels and sprinkle evenly with 1/2 teaspoon salt; let stand 30 minutes. Place second double layer paper towels on top of tomatoes and press firmly to dry tomatoes.

4. Meanwhile, heat 1 tablespoon oil in 12-inch nonstick skillet over medium heat until shimmering. Add onions, remaining 1/2 teaspoon salt, and 1/4 teaspoon pepper; cook, stirring occasionally, until onions are softened and dark golden brown, 20 to 25 minutes. Set onions aside.

5. Combine garlic, 3 tablespoons oil, remaining 1/2 teaspoon pepper, and thyme in small bowl. In large bowl, toss zucchini and summer squash in half of oil mixture, then arrange in greased baking dish. Arrange caramelized onions in even layer over squash. Slightly overlap tomato slices in single layer on top of onions. Spoon remaining garlic-oil mixture evenly over tomatoes. Bake until vegetables are tender and tomatoes are starting to brown on edges, 40 to 45 minutes.

6. Meanwhile, process bread in food processor until finely ground, about 10 seconds. (You should have about 1 cup crumbs.) Combine bread crumbs, remaining tablespoon oil, Parmesan, and shallots in medium bowl. Remove baking dish from oven and increase heat to 450 degrees. Sprinkle bread-crumb mixture evenly on top of tomatoes. Bake gratin until bubbling and cheese is lightly browned, 5 to 10 minutes. Sprinkle with basil and let sit at room temperature 10 minutes before serving.