Carl Grundstrom and Noah Cates also scored for Philadelphia (16-9-3), which won for the fifth time in seven games. Dan Vladar made 17 saves.
Collin Graf scored for San Jose (14-14-3), which lost for the third time in its past four. Alex Nedeljkovic made 26 saves.
Graf made it 1-0 at 11:33 on the Sharks' first shot of the game, marking his third goal in three games. John Klingberg faked out Vladar by drawing the goalie out to the left post. Instead of taking the shot, Klingberg passed across the slot to Graf who netted the one-timer.
Dvorak tied the game 1-1 at 18:39 with his first goal in 10 games, pushing a puck between the skates of Sharks defenseman Sam Dickinson before skating in and deking Nedeljkovic. Travis Konecny had the secondary assist on the goal for his 500th NHL point.
Grundstrom put the Flyers ahead 2-1 at 3:20 of the second period when he deflected Nick Seeler's shot from the blue line. It was Grundstrom's first goal of the season, and came in his first game against his former team -- the Sharks traded Grundstrom to the Flyers on Oct. 5.
Cates wrist shot found the back of the net at 19:48 to put the Flyers ahead 3-1. He settled a saucer pass from Bobby Brink on the rush to score from the left face-off circle.
Konecny closed the scoring with an empty-net goal at 18:17, assisted by Dvorak.
The Sharks signed goalie Justin Kowalkoski to an amateur tryout agreement Tuesday to serve as Nedeljkovic's backup. Goalie Yaroslav Askarov was out because of an illness.