Heat the olive oil in a large saucepan over medium heat. Add the onion and garlic and cook, stirring, until softened, about 4 minutes. Add the yellow squash and zucchini and cook, stirring, for 4 to 5 minutes more. Season with salt, pepper and red pepper flakes. Stir in the crushed tomatoes and tomato sauce; bring to a simmer. Cook, stirring occasionally, about 20 minutes. Add salt, pepper and a pinch of sugar, if necessary.
In a large bowl, mix together the ricotta cheese, spinach, pesto and season with pepper.
Grease the bottom and sides of your lasagna dish with butter. Spread a little of the tomato sauce on the bottom of the pan. Lay 4 noodles across the bottom of the baking dish, overlapping by 1/2-inch. Spread 1/3 of the ricotta and pesto mixture evenly on top. Sprinkle with about a 1/2 cup mozzarella cheese. Ladle about 1 cup of sauce on top. Repeat layering in the same order. Layer the top layer of noodles and drizzle with the remaining sauce, then sprinkle with the Parmesan and remaining mozzarella. Cover with foil and bake in the center of the oven until the sauce is bubbling around the edges, about 40 minutes. Uncover and bake 5 minutes more. Let stand 10 minutes before slicing.