Dougie Hamilton returned to the lineup for the Devils after the defenseman missed the previous 18 games because of a lower-body injury. He had four shots on goal and four blocked shots in 23:43 of ice time in his first game since March 4.
"It was great just to be back playing," Hamilton said. "To be able to get ready for playoffs. So I just want to keep it going for the next couple days and keep trying to get better and get ready."
Erik Haula had a goal and an assist, and Nico Daws made 22 saves for the Devils (42-33-7) in their regular-season finale.
New Jersey finishes as the No. 3 seed in the Metropolitan Division for the Stanley Cup Playoffs and will face the Carolina Hurricanes, the No. 2 seed, in the Eastern Conference First Round.
"It's a team that knows exactly who they are," New Jersey coach Sheldon Keefe said of the Hurricanes. "Not a lot of change over the years for them except, I think they've developed more skill within their lineup. They're a high-pressure team. They're going to put lots of stress on you and it's going to be on us to manage that."
The Red Wings appeared to take a 1-0 lead 7:40 into the first period when Vladimir Tarasenko scored on a snapshot from the left circle on the power play, but the Devils successfully challenged for goalie interference by J.T. Compher.
Berggren gave Detroit a 1-0 lead at 17:07 of the first period on a snap shot from low in the left face-off circle.
Compher scored off a rush down right wing for a 2-0 lead at 5:20 of the second period.
Larkin pushed it to 3-0 on a snap shot from the high slot at 2:55 of the third period for his 30th goal of the season.
"We're getting there ... it's starting to come," Detroit coach Todd McLellan said. "The teams we're playing are not as loaded as we'd like them to be. We'll take what we can get and find ways to win. We prepared like we always do. We asked them to play for each other, commit to these last six periods, now three. That wasn't too much to ask."
The Red Wings will conclude their regular season at the Toronto Maple Leafs on Thursday.
"We're hockey players and we had a job to do, so it felt good to get a win tonight," Lyon said. "I felt comfortable, found a nice groove. It's always good to get the win for sure."
Haula scored a power-play goal on a tip-in from the slot to pull the Devils to within 3-1 at 11:32.