SAN FRANCISCO (AP) -- Cole Hamels tries to control what he can. For one night, he could not control anything.

Philadelphia Phillies pitcher Cole Hamels, right, stands on the mound as catcher Carlos Ruiz (51) approaches, before Hamels was removed during the fourth inning (AP Photo/Jeff Chiu)

Hamels lasted one out into the fourth inning, his shortest outing in nearly four years, and the Philadelphia Phillies lost 15-2 to the San Francisco Giants on Friday night.

"He looked like he was all over the place. He didn't have command," Phillies interim manager Pete Mackanin said. "He competed out there. You can't have a good outing every time and I'm sure this is one he wants to forget about."

Hamels, who has been the subject of trade rumors, said it's difficult to prepare for these struggles.

"No amount of experience will put you in this situation," he said. "There are a lot of different variables going on. It's hard to find the words to describe it."

It was Hamels' shortest outing since going three innings on Sept. 8, 2011. The nine earned runs were a career high and the 12 hits allowed matched his career worst.

"Cole can get anybody out on a given day," Mackanin said. "Today wasn't that day. We all know he's much better that. There is a lot going on. Who knows? He might be pressing with the trading deadline coming around."

The Phillies have been outscored 26-2 over their last three games and Hamels acknowledged letting the Giants score in the first weighed on him.

"This game can be a physical and mental grind," Hamels said. "Sometimes you want to get quick innings and you aren't able to make the right pitches at the right time and you're leaving pitches out over the plate. Confidence can build, especially with a good team. Sometimes it can be tough."

Hunter Pence hit a grand slam as part of an eight-run fourth inning against the former All-Star.

"I've played with him long enough to know not to be surprised," All-Star pitcher Madison Bumgarner said of Pence. "He's that good and he's fun to watch."

Joe Panik, Justin Maxwell and Matt Duffy each recorded four hits, the first time a trio of Giants have accomplished the feat since Tom Haller, Jesus Alou and Hal Lanier did it on May 22, 1965.

Bumgarner (9-5) went 5 2-3 innings, allowing two runs on eight hits. He failed to finish six innings in back-to-back starts for the first time this season.

Bumgarner and Hamels were the first former World Series MVPs to meet in four years.

Hamels (5-7) got the first out of the fourth and then surrendered seven hits and walked a batter before Jake Diekman came in to finish the inning.

Brandon Belt doubled, Maxwell walked and Bumgarner singled to load the bases ahead of a two-run single from Pagan. Panik singled to re-load the bases before Duffy singled home two more runs. Buster Posey singled ahead of Pence's slam.

"The moment it left my hand I knew it wasn't going to be good," Hamels said. "I was hoping he'd miss it or foul it back. But with the strength he has, you know the writing on the wall."

Carlos Ruiz homered and Domonic Brown drove in a run for the Phillies, who have lost 13 of 16 on the heels of a three-game winning streak June 21-23.

TRAINER'S ROOM:

Phillies: Right-hander Jerome Williams (left hamstring strain) is scheduled to make another rehab start for Double-A Reading this weekend. He gave up two earned runs on four hits over 3 2-3 innings in his first rehab start Tuesday.

Giants: Right-handers Tim Hudson and Tim Lincecum each pitched a bullpen session. Left-hander Jeremy Affeldt also threw a bullpen and is scheduled for another on Sunday.

UP NEXT:

Phillies: Right-hander David Buchanan (0-5, 8.76) returns to the big leagues for his first start since April 30. He went 3-0, with a 2.43 ERA in seven minor league appearances. He lost his only career start against the Giants, last August, despite allowing just two earned runs in 6 2-3 innings.

Giants: Ryan Vogelsong (6-6, 4.10) was ejected from his last start for arguing balls and strikes after allowing a run on three hits in four innings. He's 1-1 with 5.15 ERA in four starts against the Phillies.

(© 2015 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed)