Trim the squash then cut lengthwise into ¼-inch-thick planks. Toss the squash with 1 teaspoon salt and set in a colander to drain while you prepare the rest of the ingredients.
Stir together the ricotta, salami and basil in a bowl. Season lightly with salt and pepper. Rinse the squash and gently squeeze the planks to remove as much excess water as possible; pat dry with paper towels.
Drizzle 1 tablespoon olive oil over the bottom of a 2-quart gratin dish. Spoon about ¼ cup tomato sauce evenly over the bottom of the dish. Arrange enough squash planks in the bottom of the dish to cover it (you may have to cut some to make them fit). Spoon ½ of the ricotta mixture over the squash and spread evenly. Sprinkle 1/3 of the mozzarella over the ricotta then evenly spoon about 1 cup of the tomato sauce over top.
Arrange another layer of squash planks and top with the remaining ricotta mixture. Sprinkle another 1/3 of the mozzarella over top then evenly spoon about 1 cup tomato sauce over top. Arrange a final layer of squash planks and top with the remaining tomato sauce. Sprinkle the remaining mozzarella over top and drizzle with 1 tablespoon olive oil.
Set the dish on a rimmed baking sheet (to catch any drips) and bake until cheese is bubbling and golden and the squash is tender when pierced with a knife, about 40 minutes.
Remove from the oven and let sit for 5 to 10 minutes before cutting into squares to serve.