Cain's injury limited him to three innings and, at least temporarily, cast the right-hander's immediate pitching future into doubt. The same went for Casilla, San Francisco's top setup reliever, who hurt himself while running to first base in a meaningless ninth-inning at-bat.
Cain's departure, given the early juncture of the game when it occurred, did nothing to deter the Giants (29-18), who retained the National League's best record one night after a deflating 5-4 defeat. The outcome assured the Giants of returning home with the NL West lead over the Rockies, who trail San Francisco by three games entering Thursday's series finale.
"It was a bounce-back win after a tough loss," Giants manager Bruce Bochy said.
Yusmeiro Petit (3-1), Cain's likely replacement in the starting rotation, cemented the win with three shutout innings of relief.
"Cain and Petit pitched to the edges of the plate really well, ran the ball really well," Colorado manager Walt Weiss said. "That was the biggest thing. They didn't throw many pitches in the middle of the plate."
Stymied by Rockies starter Jhoulys Chacin for three innings, the Giants ended the right-hander's shutout and no-hitter with Pence's leadoff homer in the fourth, which lengthened his hitting streak to eight games. During that stretch, Pence is batting .455 (15-for-33).
As is their custom, the Giants struck with two outs while adding two runs in the sixth. Sandoval prolonged the inning by homering off Chacin before Michael Morse and Hector Sanchez roped back-to-back doubles. Of the Giants' last 33 RBIs, 20 have occurred with two outs. They entered the game leading the league in this category.
Crawford belted a one-out homer in the seventh before the Giants manufactured an eighth-inning run on Pence's walk, Sandoval's single and Morse's groundout.
After his nine-game hitting streak dissolved Tuesday, Sandoval went 2-for-4 and is batting .222.
That widened San Francisco's lead to 5-0, which appeared endangered when the Rockies loaded the bases with nobody out in the eighth. But Casilla quickly doused the threat by coaxing a double-play grounder from reigning NL batting champion Michael Cuddyer. The play featured shortstop Crawford shoveling the ball from his glove to second baseman Brandon Hicks, who barehanded the toss and relayed it to first base.