Preheat your oven to 350°F (175°C). Lightly grease a small or medium baking dish so the casserole doesn’t stick and cleans up easily.
Place the cubed sweet potatoes in a large pot and cover with water. Bring to a boil, then simmer until very tender when pierced with a fork, about 12–15 minutes. Drain well.
Mash the potatoes until smooth. Stir in 2 tablespoons of butter, milk, egg, vanilla, and salt. Mix until creamy and fully combined.
Spread the mashed sweet potato mixture evenly into the prepared baking dish.
Make the brown sugar topping by combining flour, 2 tablespoons of cold butter (cut into small pieces), and 1/2 cup brown sugar in a small bowl. Use your fingertips or a pastry blender to rub the butter into the dry ingredients until the mixture resembles coarse crumbs.
Sprinkle the brown sugar topping evenly over the mashed sweet potatoes.
Bake in the preheated oven for about 25–30 minutes, until the topping is golden and the casserole is heated through.
If you’d like a crisper top, you can set the oven to broil for the last 1–2 minutes, watching closely to avoid burning.
Remove from the oven and let it rest for 5–10 minutes before serving to allow the flavors to settle and the casserole to firm up slightly.