SAN FRANCISCO - After a spirited ninth inning that saw the Phillies tie the game, Ben Revere tried to keep the momentum going in the 10th. He beat out an infield single and then attempted to steal second with Domonic Brown up and Jimmy Rollins on deck.

But Revere was called out by Alfonso Marquez. And in the bottom of the inning, San Francisco reserve outfielder Andres Torres punched a two-out, RBI single to rightfield off Antonio Bastardo as the Phillies fell yesterday, 4-3.

On the replay of Revere's stolen base attempt, it looked like he got his left hand on the bag in time.

"My whole arm was - what can I do?" Revere said. "That right there is pretty much a downer. I was in there. I was safe. It just kind of ticked me off."

Aside from the afternoon matinee at AT&T Park, all was not lost in San Francisco in a week that began with the Phillies in as precarious of a position as possible in the first full week of May.

The Phils were on the wrong end of back-to-back losses in which they scored a grand total of two runs against the sad-sack Miami Marlins over the weekend. The second of those losses saw Roy Halladay's struggles reach a plateau, with the former ace admitting to shoulder soreness and the Philadelphia region responding with panic that the pitcher's career could be over.

Then the Phillies boarded a plane bound for San Francisco, where they would play three straight games against the defending world champion Giants.

The Phils nearly flipped the ominous script in their favor in 3 days by the bay.

After winning the first two games in impressive fashion, with complete team efforts, and then receiving news that Halladay was not lost for the season before taking the field yesterday, the Phils failed in their attempt to complete a three-game sweep. But they made it a game despite another lackluster effort from the offense for the majority of the game.

"We tied the game up, but we couldn't get the big hit to push us over the top," Phillies manager Charlie Manuel said. "These games here have been exciting and we played good and we had a chance to win. We didn't get it done today. We were right there."

"The way we wanted to play it is what matters most," Rollins said. "We can stand tall on that and hopefully take that to Arizona and throughout."

The Phils staved off defeat in nine innings, rallying for two runs in the ninth, but couldn't complete the comeback win as the bullpen faltered. Before Bastardo's wild 10th inning - he allowed two hits and a walk, while also throwing a wild pitch - Mike Adams flirted with trouble in the ninth but received strong defensive efforts from both Delmon Young and Revere to put a zero on the scoreboard.

Before their ninth-inning surge, the Phils were in danger of losing another game because of an anemic offense. Before the rally, they were primed to score two or fewer runs for the 16th time in 35 games.

But the late heroics of Rollins (leadoff double) and Chase Utley (one-out single, followed by excellent baserunning), fueled a game-tying rally in the ninth off San Francisco closer Sergio Romo. Young's sacrifice fly tied the game at 3-3 in the top of the ninth.

"A comeback like that against Romo and everything," Revere said. "To come in here to the defending world champs' house and play that well is pretty good."

Before the late-inning drama, Jonathan Pettibone was in line for the first loss of his young career.

Pettibone gave up consecutive two-out, bloop hits in the fifth inning and surrendered a two-out, run-scoring single to opposing pitcher Barry Zito in the sixth as San Francisco turned a 1-1 game into 3-1 in the span of two innings.

Entering the fifth, the two teams were deadlocked at 1-1. Both runs came on solo home runs.

Former Phillie-turned-Giant Hunter Pence led off the second inning with his second home run of the series. Two innings later, former Giant Kevin Frandsen, starting in place of Ryan Howard at first base, ripped his first home run of the season off Zito.

The Phillies' offense generated little else off Zito. The veteran lefthander limited the Phils to four hits in the game's first seven innings.

The third of those hits, a one-out double by Rollins in the sixth, went to waste when Rollins tried to steal third and was thrown out easily. On an afternoon when the Phils couldn't afford a rally killer, Rollins' play was just that .

"That's a good play if you make it," Manuel said. "If you don't make it, it's not a good play."

"With one out, that's when you're going to try to take chances right there," Rollins said. "Zito is a breaking-ball pitcher. It was a breaking-ball count. Put those things together and it's a situation where we can tie the ballgame. He threw a fastball. They got me."

The Phils entered the day with the chance to complete their first sweep in San Francisco since 1984 and exited with four more games on their current road trip. They begin a four-game series in Arizona tonight.

Pettibone was the latest hard-luck member of the Phils' rotation. Although he walked twice a many batters yesterday (four) as he had in his first three major league starts combined (two), Pettibone pitched out of trouble and was the recipient of bad luck, too.

With the Phils and Giants tied at 1-1 and Gregor Blanco at second with two outs in the fifth, Pettibone watched as Marco Scutaro popped a fly to no-man's land in shallow center. By the time three Phillies converged, the ball had already found a landing spot and Blanco found home plate to give the Giants the lead.

"That ball just fell quickly," Revere said. "It fell into the right spot."

Pettibone allowed three runs on seven hits in 5 2/3 innings. He is 2-0 with a 3.63 ERA in four starts since joining the Phils rotation last month.

"He pitched good, really," Manuel said. "To be his first time up in the major leagues, he's held his own, he's done pretty good."

On Twitter: @ryanlawrence21

Blog: ph.ly/HighCheese