Kasperi Kapanen and Jason Spezza each had a goal and an assist, Mitchell Marner scored the tying goal, and Andersen made 37 saves for Toronto (7-5-3), which won for the first time in three games.
It was the longest shootout in Maple Leafs history.
WATCH: [All Maple Leafs vs. Flyers highlights]
"We've got a pretty good list, and then as time went on, you're starting to wonder where you're going, for sure," Toronto coach Mike Babcock said of the shootout. "Obviously, some guys do a lot of real good things and in shootouts weren't as good. Other guys came through for us. It was good for [Johnsson] and good for our team."
Ivan Provorov and Claude Giroux each had a goal and an assist, and Travis Sanheim scored for the Flyers (6-5-2), who were coming off a 4-3 shootout win at the New Jersey Devils on Friday. Brian Elliott made 23 saves through overtime and denied nine Maple Leafs in the shootout.
"Overall, we played real well in the second and third," Philadelphia coach Alain Vigneault said. "We had a power play in overtime where we had a couple of good looks, and 11 shooters later we came up a point short, a goal short."
Marner tied the game 3-3 at 5:03 of the third period when he scored at 4-on-4. He jumped on a Flyers turnover at center ice, skated around Matt Niskanen on the right side before going around the net and tucking the puck inside the left post.