Phillies general manager Ruben Amaro Jr. is looking to buy as the team continued its July surge and entered the All-Star break with a .500 record after scraping past the lowly Chicago White Sox 4-3 in 10 innings Sunday at Citizens Bank Park.

With the bases loaded, John Mayberry Jr. slapped a walk-off, two-out base hit into center field off relief pitcher Ramon Troncoso to close Philadelphia’s 10-game homestand with a 7-3 record. But while successful overall, this stretch also was marred with mistakes and missed opportunities.

“I think we made a statement that if we’re going to be a contender and win our division or the wild card or whatever, we still need some help,” Phillies manager Charlie Manuel said.

Cole Hamels allowed just two earned runs on eight hits in eight innings. He struck out seven and walked none but didn’t factor in the decision after Jonathan Papelbon blew his fifth save of the season, drawing scattered boos from the announced crowd of 40,151 fans and sending the Phils to extra innings for the third time in two days.

Philadelphia has won five of its last six series, including against Pittsburgh, Atlanta and Washington, three of the top teams in the National League. The Phils are 6½ games back of the NL East lead and 5½ games back of the second wild card berth, with three teams ahead of them.

“What’s meaningful is that we’re not out of the race,” Phillies shortstop Jimmy Rollins said. “And we have 60-something games left I think, and that’s going to determine the season. No matter how good you are, you’re going to lose 50 games, you’re going to win 50 games. So it’s that 62 that really make the difference. And it’s going to come down to the last weekend like it has been for the last couple of years, and hopefully we’re popping bottles.”