Will Cuylle of the New York Rangers celebrates his second-period...

Will Cuylle of the New York Rangers celebrates his second-period goal against the Islanders at Madison Square Garden on Sunday. Credit: Jim McIsaac

After three straight losses, Islanders coach Patrick Roy decided it was time to change things up. He flip-flopped his top two right wings, putting Kyle Palmieri with Bo Horvat and Brock Nelson and Mathew Barzal with Jean-Gabriel Pageau and Anders Lee.

Rangers coach Peter Laviolette switched a couple of things up, too, though his changes were to his bottom two lines. He moved Jonny Brodzinski to the third line, with Alex Wennberg and Kaapo Kakko, to put together a checking line of Will Cuylle, Barclay Goodrow and Jimmy Vesey to match against the Barzal line.

“Just to be at home, and have that line to use in that manner, I think, at times, is important,’’ Laviolette said of his maneuvering. “In the game, and in the playoffs, having a line that can do that . . . can be really useful. So I just wanted to get a look at that today.’’

The changes worked out for Laviolette. Brodzinski, Kakko and Cuylle scored goals as the Rangers beat the Islanders, 5-2, at Madison Square Garden, securing their second straight win and fourth in five games in a seven-day period.

The Islanders (29-23-15), in a dogfight to earn a playoff spot, fell to 0-3-1 after their recent six-game winning streak. The Islanders and Capitals are one point behind the Red Wings for the last wild-card spot in the Eastern Conference.

“I saw a team that played better than us today,’’ a disappointed Roy said. “They managed the puck much better than we did. They’re very fast on transition. I thought they had more energy than us for some reason. I thought we had some desperation. We made it a 2-2 game, and all of a sudden, bad tracking and they scored and made it 3-2.

“After that, I just felt like they shut down the game. They played a great game. They did what they had to do, and that’s why they’re first in our division.”

The Metropolitan Division-leading Rangers (45-19-4) are four points ahead of the second-place Hurricanes.

The Rangers took a 3-2 lead into the third period, and goals by Kakko and Alexis Lafreniere allowed them to pull away.

All was not rosy for the Rangers, though. They finished without defenseman Ryan Lindgren, who was helped off the ice with 4:21 remaining in the second period after he was injured while being taken into the end boards by the Islanders’ Jean-Gabriel Pageau. Lindgren

didn’t put any weight on his left leg as he was helped off the ice and did not return to the game.

Laviolette didn’t offer any kind of update after the game other than to say Lindgren was “getting evaluated now.’’

A series of penalties to both teams led to the game’s opening goal, a shorthanded effort by Horvat.

The Rangers’ Vincent Trocheck was sent off for holding, giving the Islanders a power play. Then Pierre Engvall was sent off for holding, ending that power play seven seconds early.

The Islanders won the ensuing faceoff, controlled the puck and worked it up the ice, and Nelson set up Horvat for a one-timer that beat Igor Shesterkin (25 saves) at 14:08.

Mika Zibanejad tied it for the Rangers 27 seconds into the second period, blasting a shot from the top of the slot off a pass from Jack Roslovic after Roslovic retrieved a loose puck on the right boards.

That started off a goal-filled second period in which Cuylle gave the Rangers a 2-1 lead with a left-circle shot at 10:14 before Horvat tied it at 13:55 with his second goal of the game.

The Rangers retook the lead 1:06 later on a goal by Brodzinski, who redirected a shot by K’Andre Miller past Ilya Sorokin (26 saves) for his fifth goal.

“They kind of took it to us, and we definitely didn’t have enough pushback,’’ Horvat said. “In this stage of the season, we need to have a lot better push than that if we want to beat those guys.”