Philadelphia has led the conference and the Atlantic Division since Jan. 8, but the Penguins had won eight of 10 and had a chance to tie their cross-state rivals at 100 points with a regulation victory.
Goals by Jeff Carter, Scott Hartnell, and Claude Giroux and 25 saves by Sergei Bobrovsky prevented that for the Flyers, who won in regulation for the second time in seven games.
Alex Kovalev and Tyler Kennedy scored for Pittsburgh, which had won four straight games in a shootout.
The Flyers used a few tricky bounces to solve Penguins goalie Marc-Andre Fleury, who had allowed only two goals in three games and had won six of eight starts with a 1.68 goals-against average and one shutout.
Carter was credited with Philadelphia's first goal, his team-high 35th. It was determined that Braydon Coburn's wrist shot from along the right-wing boards 15:56 in was deflected lightly by Carter's stick before hitting the far post. It then bounced back off the back of Fleury's pad and went in.
That tied it at 1 after Kovalev scored his 16th goal of the season and second in 15 games with Pittsburgh with 7:38 left in the first.
Leino had the final two goals of the game, each on a peculiar deflection. He made it 4-2 early in the third when Hartnell's shot from the point bounced off Leino's upper body as he stood just to the left of Fleury - and then, again, off the back of Fleury and into the net.
Leino's 19th of the season came 3:08 later. His shot from right of the crease climbed up Fleury and fluttered over the goal line before Pittsburgh defenseman Zbynek Michalek could swat it out.
The Flyers, who lost 2-1 in a shootout at home to the Penguins on Thursday, have won all three games in Pittsburgh. Philadelphia is 16-3-2 against divisional opponents.
Philadelphia has a four-point lead - and a game in hand - on the Penguins, who have only five games remaining.
The Flyers, who moved three points ahead of Washington in the Eastern race, took the lead for good over the Penguins with two goals 47 seconds apart late in the second.
Hartnell tied it with a power-play goal with 6:15 left. Giroux's wrist shot from the slot, his 25th of the season and fifth against the Penguins, gave the Flyers the lead at 14:42.
Notes: The Flyers set a team record with their 25th road win. ... Kennedy's 19th goal extended his career high. ... The seven goals in the game were three more than the total output for the Penguins and their opponents in their previous three games combined. ... The Flyers are 6-1-4 in their past 11. ... Penguins coach Dan Bylsma said that injured C Dustin Jeffrey - out the past three games with a knee injury - had an MRI that revealed damage. The extent hasn't been determined. ... Penguins C Mark Letestu returned after missing five games because of an undisclosed upper body injury.