Boston had won three in row, including 3-2 in overtime at the Columbus Blue Jackets on Monday.
"We just made some mistakes we couldn't overcome," Bruins coach Bruce Cassidy said.
Erik Haula gave Boston a 1-0 lead at 4:43 of the first period with a wrist shot from the right face-off circle.
Brandon Carlo made it 2-0 with a shorthanded goal at 14:17, but Dylan Larkin cut it to 2-1 at 19:20 with his 30th goal of the season.
"I wasn't happy with myself on the shorthanded goal, so I wanted to get one back," Larkin said. "[Oskar Sundqvist] gave me a great screen and I was able to flick one in. That was huge, keeping from us going into the locker room down 2-0."
Michael Rasmussen tied it 2-2 at 5:46 of the second period, knocking a loose puck past Swayman, and Filip Zadina gave the Red Wings a 3-2 lead at 8:28 on a one-timer from Vrana.
"I think the late goal in the first gave them some juice going into the room, and that's something we have to clean up," Carlo said. "It's not an issue as long as we stay dialed in and keep on top of things, but we got off our game a little bit in the second period and they took advantage of it."
Vrana made it 4-2 with a power-play goal at 4:08 of the third period. Vrana, who missed the first 56 games this season after shoulder surgery, has eight goals in 14 games.
"He has an elite, elite ability to score," Blashill said. "I just think his all-around game needs to get better, and he and I have had a lot of conversations about that. But he scores in tight spaces as well as anyone I've been around."