Ryan Pressly (2-2) picked up the win after starter Kyle Gibson was unable to get the final out of the fifth inning. He retired all four batters he faced.
Trevor Hildenberger gave up three straight two-out singles in the seventh, the last by Justin Upton, to produce the Tigers' fourth run. Taylor Rogers kept Detroit scoreless in the eighth thanks to flawed baserunning by Nicholas Castellanos, who tried unsuccessfully to advance to third on a one-out flyout to right.
Joe Mauer, who along with Rosario and Kepler had three hits, roped a two-run single to right in the ninth to make it 9-4.
Tyler Duffey worked a 1-2-3 ninth to close out the game.
Anibal Sanchez (3-3) gave up both home runs with the Twins also getting runs off relievers Daniel Stumpf and Alex Wilson in the seventh. Stumpf allowed a one-out single to Jason Castro and Wilson gave up an RBI triple to Brian Dozier plus a single to right by Kepler to put Minnesota up, 7-3.
Detroit has lost six of its last seven games.
Andrew Romine walked and scored on a double to left by Jose Iglesias with one out in the fifth to get Detroit within 5-2. A wild pitch and Upton's two-out ground single to center made it 5-3 and drove out Gibson. Reliever Pressly got Miguel Cabrera to pop out to right to end the threat.
Kepler belted a 2-2 fastball over the wall in right after Dozier beat out a topped two-out roller to third for a single. It was the 21st home run thrown allowed by Sanchez this season in 75 1/3 innings. The Twins took a 5-1 lead.
Rosario wiped out a 1-0 Detroit lead with a three-run home run with one out in the fourth inning. Mauer and Miguel Sano both singled with one out and Rosario lined his 15th home run into the Tigers bullpen behind the left field wall.
The Tigers got off to a 1-0 start with one out in the first when Mikie Mahtook lined his eighth home run over the fence in left center.
NOTES: RHP Michael Fulmer threw a 20-pitch bullpen Friday and could start Monday for Detroit in Texas if he comes out with no more irritation to his ulnar nerve. ... LHP Dietrich Enns, who made his first major league start Thursday for Minnesota, will make his second start sometime between Wednesday and Saturday, manager Paul Molitor said. ... Tigers LHP Daniel Norris (quad, hamstring) threw a two-inning simulated game at Toledo on Friday and will begin a rehab stint with the Mud Hens if he feels okay this weekend. ... Twins LHP Glen Perkins made the first of three rehab appearances Thursday for Double-A Chattanooga, allowing one hit in a scoreless inning.