ANAHEIM — Each of the Ducks’ past three home games have seen them retrocede leads en route to a loss, with the Boston Bruins reversing their fortunes in a 4-2 win on Friday night at Honda Center.

The Ducks went up 2-0 after a flashy first period on Friday, just as they did against the Edmonton Oilers last Wednesday in a 5-2 defeat. They blew a 2-1 lead against Calgary on Tuesday in the Flames’ first victory of the season.

“We really have to watch some film and learn how to play with the lead. Obviously, that’s a couple games now with Edmonton and Calgary, so it’s about learning from it,” forward Nikita Nesterenko said.

The Ducks scored two first-period goals in rapid succession from Tim Washe and Beckett Sennecke. Lukáš Dostál made 18 saves. The Ducks were 0 for 5 on the power play and 1 for 4 on the penalty kill.

“We couldn’t score on the power play, that definitely hurt us, and the (power-play goals allowed) hurt us as well,” defenseman Jackson LaCombe said.

Elias Lindholm scored a power-play goal and set up another by David Pastrnak, who provided a screen for Frederic Brunet’s extra-man tally. Pavel Zacha added two assists. Rookie James Hagens also had two assists, including on Matthew Poitras’ goal to ice the Bruins’ cake. Michael DiPietro stopped 25 shots in his first career NHL win.

With 3:40 left, the visitors sealed the hosts’ fate when Poitras slammed on the brakes and went to his backhand to finish an odd-man rush with Hagens.

The Bruins took their first lead of the night with their third power-play goal, with 11:42 to play. Zacha and Morgan Geekie’s tic-tac-toe passing sequence left Lindholm with a point-blank chance so open he could have blown the puck gently into the net.

“(We let a lot go) in front, and we couldn’t get our clears when we needed them,” LaCombe said. “We have to be a lot harder and a lot faster getting those pucks out.”

After failing to cash in on a four-minute man advantage, the Ducks surrendered an equalizer 3:26 into the final frame in another rough moment while shorthanded.

Not one but two cross-crease exchanges between Lindholm and Pastrnak opened up a huge hole for Pastrnak’s backhand to get through both LaCombe and Dostál. Pastrnak, who passed Brad Marchand for fourth on the Bruins’ franchise leaderboard with 423 goals, nearly scored again as the Bruins stormed the Ducks’ cage soon after. He’s four goals from Patrice Bergeron for third place.

Missed opportunities to put the game away bookended the second period for the Ducks.

They closed it on a four-minute power play after Nikita Zadorov elbowed Frank Vatrano and then took another high shot on him after the whistle. Some fluid puck movement got Leo Carlsson a prime opportunity in the slot, but former Duck Hampus Lindholm disrupted his shot so that it hit the glass rather than the net.

Less than two minutes into the frame, Nesterenko had a shorthanded breakaway but couldn’t quite get the puck on goal. That proved costly when later in the same power play, Brunet knocked the puck down at the blue line and flicked a shot through a Pastrnak screen. It was Brunet’s first NHL goal in his fifth career game at 3:15.

“I’m still mad at myself for that. In those situations you’ve got to bear down, especially in a 2-nothing game with a shorthanded goal (opportunity). That was definitely a turning point,” said Nesterenko, who turned in a strong opening 20 minutes.

In that first period, the Ducks dominated in terms of both quantity and quality of opportunities. Their crescendo came to a peak with two goals in 21 seconds during the final minute.

After Washe’s long, low-flying shot through traffic beat DiPietro through his five hole, a less than visually stunning goal for his second of the season, the Ducks scored one of the nicest markers of the young NHL campaign.

Sennecke hit the blue line with speed, finding Cutter Gauthier. Gauthier’s touch pass to Nesterenko begat another touch pass to Sennecke for a confident finish and his fifth goal this season.

“We played one of our best periods of the year in the first, and then we just kind of let it slip away,” Nesterenko said.