It was Ortiz's first multihomer game of the season, 31st overall and 29th with Boston, moving him into third place on the all-time Sox's list, ahead of Manny Ramirez and behind Ted Williams (37) and Jim Rice (35).
Josh Beckett, who started the season on the disabled list with a sore back and sore right hip, improved to 5-3 with a 4.67 ERA, going seven innings and giving up six runs on six hits and a walk with nine strikeouts. His 107 pitches, 75 for strikes, matched a season high.
Milwaukee answered Boston's home runs with four of its own, all off Beckett, just the second time in his career that he has given up four round-trippers. Ryan Braun had two home runs in going 2-for-4 with two runs scored and four RBIs.
"Guys swung the bats well today," Beckett said. "I just try to focus on the positive things. I made some good pitches, made some poor pitches. So chalk it up to that. But, at the end of the day, we won and that's what we're trying to do."
"A few balls wandered over the middle of the plate, especially early on with the first couple of hitters," Sox manager Terry Francona said. "He had a line out, then the line-drive hit. But he only walked one. He missed a lot of bats. He left some pitches over the plate to good hitters. Braun's a phenomenal hitter, and they hit him hard. The good thing was, he didn't put a lot of people on base and we scored."
Beckett spotted the Brewers with a two-run lead in the first inning, when Braun's first home run scored Mike Cameron, who got on base with a single.
The Sox cut the deficit in half in the bottom of the frame when Dustin Pedroia walked with one out and scored on Ortiz's double to left-center.
In the home half of the third inning, the Sox took the lead when Pedroia and Ortiz hit back-to-back solo homers, putting the Sox up, 3-2. For Pedroia, the drive into the Green Monster seats was his second homer of the year and his first since April 18; Ortiz's shot into the right-field seats was his ninth. It marked the third time this season that the Sox have hit back-to-back home runs. Ortiz and Ramirez accomplished the feat on May 6 in Detroit, and Coco Crisp and Jed Lowrie turned the trick on May 10 in Minnesota.
"I just got a fastball and hit it. That was it," Pedroia said. "We swung the bats great today and the whole series, so it was nice.
"It's good to score double-digit runs. It's definitely huge for us to keep adding on runs and to keep winning."
The Brewers regained the lead in the next inning, when J.J. Hardy's Green Monster home run scored Corey Hart, who had singled to center, putting the Brewers up, 4-3.
The Sox answered back with three runs in the bottom of the inning, loading the bases with no outs, when Mike Lowell reached on Prince Fielder's error at first, Kevin Youkilis singled to left and Jason Varitek walked.
After Crisp struck out following a 10-pitch at-bat, Julio Lugo walked, pushing in one run. Jacoby Ellsbury then singled to left, driving in Youkilis and Varitek, as Lugo was caught off base rounding second for the second out.
Ellsbury, who had not been caught stealing in 25 attempts since making his Major League debut last season, was two stolen bases away from tying Tim Raines' all-time record. His bid for the record ended on the third pitch to Pedroia -- a 1-1 pitchout -- as Brewers catcher Jason Kendall made a perfect throw to Rickie Weeks at second base, nailing the young Sox speedster, his first caught stealing to go with 16 stolen bases this season.
The Sox padded their lead in the fifth, when Brewers starter Carlos Villanueva gave way to Mark DiFelice, who was making his Major League debut. Pedroia singled to left and scored on Ortiz's second home run of the game, giving Boston an 8-4 advantage.
"Most of the time, they want to pitch me away, but try to come in once in a while after they stay away a whole bunch of times," said Ortiz, who pulled both his home runs to right. "They try not to make mistakes with me, and that's one thing people got to understand. It's not like they come here [saying], 'Papi, right here, hit it.' They work on me, because they know they make a mistake, they can pay."
In the sixth inning, the Brewers added back-to-back homers of their own, the first time they've done so this season, as Braun homered again into the Monster seats and Fielder followed with a solo shot into the visitors' bullpen in right field, cutting the Sox's lead to 8-6.
It was just the second time that Beckett allowed consecutive home runs in his career.
"[Beckett] wasn't perfect, and it seemed like every mistake he made went the distance," Varitek said.
The Brewers' first three home runs were off Beckett's breaking balls, the last one on a fastball.
"I think any time anybody hits a home run on a breaking ball, it's probably the pitcher's fault, because if it's down, it's a very hard pitch to lift," Beckett said.
For Ortiz, whose 3-for-5, four-RBI afternoon, improved his average to .250 -- a high watermark for him this season -- it was nice to be able to give Beckett a boost.
"Definitely," Ortiz said. "Beckett, he had pitched so many great games for us. And you don't feel the same every day. Sometimes you're going to be a little off, sometimes you're going to be on. So we got to come out and throw our best game out there for them."
The Sox added a run in the sixth when Lugo singled, went to second on Ellsbury's groundout, stole third and scored on Pedroia's single to left.
Boston extended its lead, 11-6, the next inning after Lowell singled and scored on Youkilis' ninth home run of the season.
Beckett gave way to reliever Manny Delcarmen in the eighth as Milwaukee added a run, with Weeks scoring on Braun's fourth RBI of the game, a groundout to second base.
Closer Jonathan Papelbon pitched a scoreless ninth to nail down the win for Beckett and the series for the Sox.
Maureen Mullen is a contributor to MLB.com. This story was not subject to the approval of Major League Baseball or its clubs.