"The ball looked like it was going pretty good early on," Rockies manager Walt Weiss said. "You never know what's going to happen but it was one of those days where the ball was flying."
In the 11th, Bettis (0-1) gave up a leadoff Hunter Pence single and walked two, including Joaquin Arias intentionally to load the bases with two out. Sanchez, who homered off Matt Belisle to open the eighth inning, worked Bettis' count full and fouled off offerings until he homered on Bettis' 10th-pitch fastball.
"I put myself in a bad spot and I got hurt for it," Bettis said.
The Rockies (12-11) head out to face two more National League West rivals, the Dodgers and the D-backs, after a 4-2 homestand that saw the Rockies score 44 runs. They gave up 27, but 22 of them came in the two losses.
Those games had Weiss juggling the bullpen. Righty Adam Ottavino, one of the key relievers, was unavailable Wednesday because he had pitched in the last three games.
The homers were Sanchez's first two of the year. The slam was a career first, and it made a winner of Jean Machi (4-0).
"It's a lot of feeling in that situation," Sanchez said, "because everybody wants to be the hero. In this field the ball flies. I hit it well, and right at the moment that I hit it, I knew that was out of the park."
The Rockies' Justin Morneau hit a two-run shot in the bottom of the 11th off Sergio Romo to halve the final deficit.
The Giants (12-10) scored as many runs Wednesday as they had the previous seven games combined.
Pitchers throughout, starting with the Giants' Matt Cain and the Rockies' Tyler Chatwood, were unwilling co-stars in the teams' homer highlight clips.
Troy Tulowitzki had a two-run shot off Cain in the first, but Morse answered in the second for the first of his two homers to cut the difference to 2-1. The Rockies strung together three runs on four hits and a Brandon Belt error in the second.
Chatwood's 5-2 lead wasn't anything close to safe. Brandon Hicks led off the third with a homer that kept carrying to right, and with two down, Morse added a three-run blast to center to tie the game.
Charlie Blackmon knocked his team-high fifth homer with one out in the fourth. However, Belt swatted a left-on-left two-run shot off the Rockies' Rex Brothers for a 7-6 Giants lead in the seventh.
Although he gave up the three homers and five runs in six innings, Chatwood left in position to win, mainly because he escaped a bases-loaded, no-out jam in the fifth.
"I really made two mistakes," Chatwood said. "I walked four guys, but two mistakes. I hung a slider to Morse and threw a fastball up and away to Morse and he hit it out.
"It's just one of those things. The ball was really carrying today, but those two mistakes cost me four runs. You could tell by the flags, how they were blowing out, that it was going to be one of those days. But you don't really focus on that. You focus on your pitches. We didn't execute many pitches."
Nolan Arenado's double off Cain in the seventh created a tie that lasted until Sanchez's first-pitch homer in the eighth off Belisle. Cain gave up seven runs and 10 hits in six innings plus three batters of the seventh but, incredibly, kept the Giants close.
Blackmon tied it with his second RBI in the eighth. DJ LeMahieu walked, advanced on Charlie Culberson's bunt, took another base when third-base umpire Bob Davidson called a balk on Santiago Casilla, and scored on Blackmon's fielder's choice grounder.
Casilla escaped with the bases loaded and two out in the ninth when LeMahieu flied to deep right field.