Andres Torres lined a game-ending single to right field with two outs in the 10th inning, lifting the San Francisco Giants to a 4-3 victory against the Philadelphia Phillies on Wednesday to avoid a sweep.