SAN FRANCISCO -- Five times Friday night, the Giants pitching staff finished an inning with at least two runners on.

  • 134 wins
  • 118 wins

Each time -- from starter Jonathan Sanchez inducing a grounder to end the second inning to closer Brian Wilson doing the same to end the ninth -- the Giants got out of each predicament unscathed in a 5-4 win over the Red Sox.

The top of the first inning, a 37-pitch affair by Sanchez that included a three-run homer by Kevin Youkilis, was simply a precursor for a wild, exhausting night in which the combined stat line of the Giants pitching staff included 10 walks and four wild pitches.

Despite Sanchez's struggles in the first inning, the left-hander said he bounced back from his rocky start by relying more on his changeup. The second inning also was potentially dangerous, with runners on first and second with two outs and the No. 2 hitter up, but Sanchez allowed only one runner in the third and fourth innings before exiting in the sixth.

"Great job recovering," Giants manager Bruce Bochy said. "Rough start for him and his pitch count got up there quick ... but he settled down and gave us some innings there, which was important. And not just innings, but stopped them from scoring and started hitting his spots."

But for all the adventures Sanchez went through in the first two innings, the Giants' pitching drama truly began when he left the game in the sixth.

Sergio Romo entered with one out in the sixth inning and inherited two baserunners. Following a flyout, he walked Bill Hall to load the bases, but struck out Darnell McDonald to end the threat.

In the seventh, it was Santiago Casilla's turn to add a bit of excitement. Casilla walked three batters and threw three wild pitches in the inning, but allowed no runs as he ended the inning by striking out Victor Martinez with the bases loaded.

Looking to avoid any more close calls, Bochy brought in closer Brian Wilson with the bases empty and two outs in the eighth. Wilson allowed a single and a walk before ending the inning, but left room for even more nerves in the ninth.

After retiring the first two batters of the inning, Wilson gave up a triple, two singles and a walk -- allowing one run and loading the bases -- before getting McDonald to ground out to end the game.

No need to be nervous, right?

"Wilson's a good pitcher," Giants shortstop Juan Uribe said. "I don't ever get too nervous when Wilson goes on the mound. I believe in the guy and I know he can do it."

The same went for Sanchez (6-5), who was already in the clubhouse and done icing his shoulder while Wilson flirted with a tied game in the ninth.

"I know he's going to get the outs," Sanchez said. "He made us all sweat a little bit, but he'll always get through the inning."

Despite his rough start, Sanchez didn't sweat much, thanks to San Francisco's offense. After initially going down in order to open the game, the Giants got to Boston starter Tim Wakefield (2-6) and his knuckleball in the second.

Buster Posey hit an RBI single up the middle to score Pablo Sandoval, who led off the inning and advanced to second on a wild pitch. After Aaron Rowand walked, Eli Whiteside reached on an infield single, loading the bases with one out for Sanchez.

Sanchez laid down a beautiful, well-placed bunt just beyond the reach of pitcher Tim Wakefield, who, after finally retrieving the ball, wildly flipped it over the head of Red Sox second baseman Dustin Pedroia at first, as both Posey and Rowand scored.

The following inning, Uribe hit his team-leading 12th home run of the season to break the tie and Nate Schierholtz scored on a sacrifice fly by Freddy Sanchez in the eighth for what turned out to be a much-needed insurance run for Wilson and the bullpen.

"That's a lot of pitches," Bochy said of Wilson, who threw 42 pitches. "Both [Wilson] and Casilla, they worked hard out there. I knew I could get two [innings] out of them, or stretch them a little bit, but to be honest, I didn't want them to work that hard."