Matt Cain's bid for consecutive perfect games ended on his third pitch Monday night, but he was still effective enough to earn his eighth straight victory.

Melky Cabrera smacked three hits, while Brandon Crawford and Ryan Theriot registered a pair of RBI apiece as the San Francisco Giants downed the LA Angels of Anaheim, 5-3, in the opener of a three-game interleague series.

Cain (9-2) labored through five innings, surrendering three runs on six hits and a season-high four walks for the Giants, who had lost three of their previous four coming in.

"I was a little energized from the last game. It was a relief to get back on the mound and get that one out of the way," Cain said. "My goal is to stay in the game long enough to give our team a chance to win."

He entered the night retiring his last 32 batters, but that streak was halted in the home first as Mike Trout led off and stroked a single to left. Pujols then put an end to Cain's 20-inning stretch without allowing an earned run later in the frame as he lifted a sacrifice fly to right.

Although Cain was far from perfect, the Giants' quartet of Shane Loux, Sergio Romo, Jeremy Affeldt and Santiago Casilla was as they retired the final 12 batters in succession.

"I was pumped for our bullpen to come in and finish the game," Cain said.

Former Giant Jerome Williams (6-5) was touched for four runs on seven hits and three walks in 3 1/3 innings, but was hospitalized sometime during the game after complaining of shortness of breath.

"Jerome felt fine on the bench during the game," Angels manager Mike Scioscia said. "When he came out of the game he was dizzy, so we took him to the hospital. He'll stay overnight and have some tests done."

Mark Trumbo cracked his 16th homer of the season while Erick Aybar was the only Angel to record two hits.

Following Pujols' sac fly in the first, Crawford belted a two-run triple to right in the visitors' second to give San Francisco a 2-1 advantage.

Trumbo stroked a solo blast over the wall in right-center in the home second to knot the score, but the Giants plated the next two to reclaim the lead for good.

Angel Pagan poked an RBI single through the hole on the right side in the third while Theriot pulled a ball through the left side of the infield for a run-scoring base hit in the fourth to make it 4-2.

Bobby Wilson's sacrifice fly in the home fourth cut the deficit to 4-3, but the Giants got the run back in the sixth as Theriot slapped an RBI single to center for a 5-3 San Francisco edge.

Casilla fanned one in the ninth en route to his 19th save of the season.

Game Notes

Cabrera's multi-hit game was his MLB-leading 32nd of the year...Of the 17 pitchers to toss a perfect game since the Chicago White Sox's Charlie Robertson in 1922, Cain was one of six hurlers to win his next start...Williams spent his first two-plus years in San Francisco before being traded to the Cubs in 2005. Williams was 17-14 with a 3.93 ERA during his stint with the Giants...Trout stole three more bases, giving him an MLB- leading 19 for the year.