01 - Preheat oven to 375°F (190°C). Grease a 9x13-inch baking dish with olive oil or nonstick spray.
02 - Heat olive oil in a large skillet over medium heat. Add chopped onion and cook until translucent, about 3 minutes. Add minced garlic and sauté for 1 minute. Incorporate spinach and cook until wilted, around 2 minutes. Remove from heat and set aside.
03 - Melt butter in a medium saucepan over medium heat. Whisk in flour and cook for 1 minute. Gradually pour in milk and heavy cream, whisking continuously until smooth and thickened, about 4-5 minutes. Stir in Parmesan cheese, ground nutmeg, salt, and pepper. Remove from heat.
04 - Spread a thin layer of Alfredo sauce on the bottom of the prepared baking dish. Arrange a single layer of sweet potato slices over the sauce, slightly overlapping.
05 - Top with half of the sautéed spinach mixture. Dollop half of the ricotta cheese over the spinach. Pour a portion of Alfredo sauce over the layer and sprinkle with mozzarella cheese.
06 - Arrange another layer of sweet potato slices. Add remaining spinach, ricotta, Alfredo sauce, and mozzarella cheese. Finish with a last layer of sweet potatoes, remaining Alfredo sauce, and the rest of the mozzarella.
07 - Cover the dish tightly with foil and bake in preheated oven for 30 minutes. Remove the foil and continue baking for 15 to 20 minutes, until sweet potatoes are tender and cheese is bubbly and golden.
08 - Allow to stand for 10 minutes before slicing. Garnish with chopped fresh basil if desired.