PHOENIX (AP) -- Here's how things are going for the last-place Arizona Diamondbacks this season: One of their players hit for the cycle Friday night and they still lost an ugly game to surging San Francisco.
Kelly Johnson became the third major leaguer to hit for the cycle this year, but three Arizona errors led to three unearned runs and that was the margin in the Giants' 7-4 victory.
" He was hitting everything,'' San Francisco manager Bruce Bochy . " To win a game when you've got somebody on the other side hit for the cycle, that's a good thing."
Aubrey Huff hit two solo home runs and added an RBI single in San Francisco's 14th victory in 18 games. The Giants scored two unearned runs on consecutive throwing errors by starting pitcher Edwin Jackson . A third unearned run came home after right fielder Justin Upton misjudged a fly ball in the ninth inning.
Johnson hit a solo home run in the first, doubled in the fifth and tripled in two runs when the Diamondbacks took a 4-3 lead in the sixth. He completed the feat with a line-drive single in the eighth, becoming the fourth Arizona player to hit for the cycle in the franchise's 13-year history.
" It's a pretty cool thing to say you did that,'' Johnson said, " but unfortunately we lost."
The throwing errors by Jackson (6-9) came on what were intended to be sacrifice bunts in the Giants' three-run seventh.
" I have made those plays all year, first two throwing errors of the season,'' he said. " It is just one of those things. The first one floated up. It ended up being bang-bang, a controversial call that could have gone either way. The second one was just wild."
The sloppy play took the steam out of Johnson's feat for Arizona interim manager Kirk Gibson .
" Kelly hits for the cycle and in my mind I have no feeling for it,'' Gibson said. " We lost the game, we didn't play well."
Chris Ray (3-0) got one out for the win and Brian Wilson tossed 1 1-3 scoreless innings for his 28th save in 30 opportunities. The game went 3 hours, 45 minutes, with Arizona stranding 14 runners and San Francisco nine.
Giants reliever Jeremy Affeldt warmed up in the bullpen, then was shut down when he felt some discomfort in his side.
" We hope it's not serious,'' Bochy said. " We'll work on him tonight and check on him tomorrow and see where we're at."
Huff had his third multihomer effort of the season as the Giants stayed three games behind first-place San Diego in the NL West. He entered the game with just one hit in 13 career at-bats against Jackson.
" Jackson's always been tough on me, man,'' Huff said. " The first one I got him. Then he really started busting me in. I couldn't get to his heater. To be perfectly honest, I cheated on that second pitch there and stepped in the bucket and went all in. I got lucky on it. ... He's owned me in the past, but I was due."
San Francisco starter Jonathan Sanchez left after five with a 2-1 lead and the Giants made it 3-1 when Huff homered in the sixth.
Jackson needed little time to waste it.
Nate Schierholz singled and Eli Whiteside put down a sacrifice bunt. Jackson fielded it, but his toss to LaRoche was high and the first baseman had to jump slightly to catch it. Whiteside and LaRoche touched the base virtually at the same time and the runner was safe.
Eugenio Velez bunted to advance the runners, but Jackson threw wildly past first, allowing a run to score. Andres Torres tripled over the head of center fielder Chris Young to bring two more home and put San Francisco up 6-4. Freddy Sanchez walked and Jackson was finished.
In the ninth, Torres' fly ball soared over Upton for a two-base error. Two batters later, Huff singled Torres home.
Sanchez gave up four hits, struck out 10 and walked five. Jackson, who faced five batters without getting an out in the seventh, allowed six runs, four earned, and eight hits.
NOTES: Giants C Buster Posey , on a 16-game hitting streak with 21 RBIs in July, sat out. ... Huff entered with a .415 career average against Arizona, the best of any active player against the Diamondbacks with a minimum of 100 plate appearances. ... Jackson has allowed 19 runs, 17 earned, and 30 hits in four starts since his no-hitter at Tampa Bay on June 25.