How to Make It
Heat the oven to 350°. Oil an 8-by-8-inch baking dish.
In a large pot of boiling, salted water, cook the pasta for 7 minutes. It will be partially cooked. Drain. Rinse with cold water and drain again thoroughly.
In a medium saucepan, heat 1 1/2 tablespoons of the oil over moderately low heat. Add the onion and cook, stirring occasionally, until translucent, about 5 minutes. Add the garlic and cook, stirring, for 30 seconds. Add the tomatoes, salt, and bay leaf. Bring to a simmer over moderate heat and cook until very thick, about 10 minutes. Stir in 1/4 teaspoon of the pepper. Remove the bay leaf.
In a small bowl, combine the ricotta, 1 cup of the mozzarella, about half the Parmesan, the pesto, and the remaining 1/4 teaspoon pepper.
Put half of the cooked pasta into the prepared baking dish and top with about a third of the tomato sauce. Spread the ricotta mixture on the sauce in an even layer. Cover with the remaining pasta and then the remaining sauce. Top with the remaining 1/2 cup mozzarella and the remaining Parmesan. Drizzle with the remaining 1/2 tablespoon oil. Bake until bubbling, about 30 minutes. Let sit 10 minutes before cutting.