Preheat oven to 375 degrees F (190 degrees C). Spray a 9x11-inch casserole dish with cooking spray.
Place sweet potatoes into a large pot and cover with water; bring to a boil. Reduce heat to medium-low and simmer until tender, 15 to 20 minutes. Drain and measure 3 cups sweet potatoes; transfer back into the pot. Reserve remaining sweet potatoes for another use.
Mix white sugar, milk, eggs, cubed butter, and vanilla extract into sweet potatoes using an electric mixer until completely smooth. Pour mixture into the prepared dish.
Combine pecans, coconut, brown sugar, flour, and melted butter in a bowl until evenly mixed and crumbly; sprinkle evenly over sweet potato mixture.
Bake in the preheated oven until topping is browned, 20 to 30 minutes.