BOSTON (AP) Hanley Ramirez told his Red Sox teammates in the dugout that he wasn't going to swing for the fences in his final at-bat.
It doesn't work for him that way.
''I don't hit homers when I try to hit homers,'' he explained to reporters after Boston's 11-7 victory over the San Francisco Giants. ''They said, `It doesn't matter. You've got three already.'''
Ramirez homered three times to drive in a career-high six runs and also helped the Red Sox with some nifty fielding on Wednesday night as Boston moved into first place in the AL East. With a chance to tie the major league record of four homers in a game, he grounded out weakly to the pitcher in his last at-bat.
Travis Shaw and Sandy Leon also homered for Boston, and Mookie Betts had three of the 15 Boston hits that made up for a poor outing from starter Drew Pomeranz. Acquired last week from San Diego for Boston's top pitching prospect, Pomeranz struggled to protect an eight-run lead and lasted just three innings in his Red Sox debut.
''Unfortunately it was an early night for him,'' manager John Farrell said. ''He'll be back out there in five days.''
Boston opened an 8-0 lead and held on to win for the eighth time in nine games and move a half-game ahead of the Baltimore Orioles, who lost 5-0 to the Yankees.
And Ramirez was the biggest reason why.
The converted first baseman made several fine fielding plays, diving to his left and his right and also starting a double play in the sixth with the bases loaded and nobody out after San Francisco had already cut Boston's 8-0 lead to 8-7.
''Everything went right today,'' he said.
Ramirez's first career three-homer game gave him 11 for the season. He hit two-run shots in the second, third and sixth inning.
Ramirez also reached base when he was hit by a pitch in the fourth, glowering at Giants reliever Albert Suarez before the umpire quickly warned both benches. The biggest crowd of the season - 38,201 - stood and chanted Ramirez's name for his final at-bat in the eighth.
Sixteen times players have hit four homers in a game, most recently by Josh Hamilton for Texas in 2012.
Matt Barnes (3-3) was awarded the victory as the first effective Red Sox pitcher, coming on with a one-run lead and the bases loaded in the sixth and pitching out of it, thanks to Ramirez's glove.
Barnes added a scoreless seventh, getting Brandon Belt on a check-swing strikeout with two on to end it, and a perfect eighth.
Pomeranz lasted just three innings, allowing five runs on eight hits and two walks.
Giants starter Matt Cain (1-6) gave up three homers and five runs in 2 1/3 innings.
Trevor Brown had three hits for the Giants. Mac Williamson hit a three-run homer, and the San Francisco right fielder also went over the right-field bullpen wall in pursuit of one of Ramirez's homers.
''I think every kid growing up, playing in Fenway would like to hit a ball over the Green Monster,'' Williamson said. ''It was definitely a special feeling rounding the bases. Seeing a ball going out here is kind of a childhood dream.''
The game wrapped up a two-game series that was the Giants' first visit to Fenway Park since 2007 and just their second since the start of interleague play. They have never beaten the Red Sox at the century-old ballpark, with their last win at Fenway coming as the New York Giants against the Boston Braves in the 1912 World Series.
The crowd was boosted by many in Giants orange - matching the 1978-82 throwback jerseys worn by the team; Boston wore the tops from its 1975 World Series team. The visitors managed to out-shout the home fans often, including in the fourth inning, when San Francisco scored five runs, and the fifth, when they added two more to make it an 8-7 game.
Ramirez dove to his right to stop a line drive in the first inning, and made a play to his right on a hard grounder from Grant Green. Then, with the bases loaded in the sixth, he gloved a sharp grounder, stepped on first and threw home.
Leon spun and tagged Belt as he slid home. The umpire signaled out, and the call stood after Giants manager Bruce Bochy challenged it.
San Francisco third baseman Ramiro Pena made a nice play of his own, going back to catch Travis Shaw's popup in shallow left to end the left inning and save a run.
Giants: Hunter Pence (surgery on right hamstring) isn't ready to resume rehab with Triple-A Sacramento. Bochy said ''he's got a chance to play'' on Thursday.
Red Sox: Put RHP Koji Uehara on the 15-day disabled list with a strain of his pectoral muscle.
Giants: Off Thursday before opening a three-game series in New York against the Yankees.
Red Sox: Open four-game series against the Minnesota Twins at Fenway.