Heat the oven to 350°F (175°C), then lightly butter a 2-quart baking dish.
Bring a large pot of water to a boil, add the sweet potatoes, and simmer for 15 to 20 minutes until a fork slides easily into the cubes.
Drain the sweet potatoes well, return them to the pot, and mash until mostly smooth.
Stir in the 4 tablespoons butter, milk, filling brown sugar, egg, vanilla, cinnamon, and 1/4 teaspoon of the salt until evenly combined.
Spread the filling into the prepared baking dish, smoothing the top with a spatula.
Mix the pecans, topping brown sugar, flour, and remaining 1/4 teaspoon salt in a bowl, then stir in the melted topping butter until crumbly.
Scatter the pecan mixture evenly over the sweet potato filling.
Bake for 30 to 35 minutes until the topping is golden and the filling is bubbling around the edges.
Let the casserole rest for 10 minutes so the filling can settle before serving.