Make a long, narrow cut lengthwise down the center of each sweet potato. Wrap each potato in aluminum foil.
Bake potatoes directly on the rack of the preheated oven until tender, about 1 hour.
Mash avocado flesh, salt, and pepper together in a bowl with a fork until mostly smooth. Fold onion into avocado mixture. Cover the bowl with plastic wrap and refrigerate until chilled, about 45 minutes.
Remove potatoes from foil and slice open, pushing the two ends of each together to open the potato. Divide 1/2 of the butter between the potato openings. Spoon avocado mixture into each potato and top each with remaining butter.