PHILADELPHIA — Aaron Altherr had quite a game for a guy who sat on the bench the first six innings.

Altherr's RBI single in the bottom of the 11th inning lifted the Phillies to a 3-2 victory over Pittsburgh on Sunday, giving Philadelphia its first four-game sweep over the Pirates in 24 years.

Andrew Knapp hit an opposite-field triple off the left-field wall with one out off Rich Rodriguez (0-1). With the infield in, Altherr pulled a 1-2 pitch to left for his third hit. He raised his hand in the air, ran to first and got mobbed by teammates.

"Feels great to have my first walk-off in the big leagues," Altherr said.

Altherr finished 3 for 3 with a triple, raising his average from .104 to .157. He's had to adjust to not being in the lineup every game because manager Gabe Kapler is rotating 10 players for eight starting spots.

"It's been really difficult as the days went on," Altherr said. "I'm trying to stay positive and keep rolling."

Kapler raved about Altherr's attitude.

"Coming into the season, we felt he was one of our best offensive players," Kapler said. "He's had some bad luck. I'm sure he wanted to play more regularly but every day he comes in with a smile, he comes prepared and he works his tail off. Good things happen to good people. He deserves it. His teammate behaviour has been unparalleled. It's outstanding."

The Phillies have won 13 of 16 since a 1-4 start and are seven games over .500 for the first time since they were 24-17 on May 18, 2016. They finished 71-91 that season and lost 96 games last year.

Philadelphia had not swept a four-game series from the Pirates since May 12-15, 1994. Pittsburgh has lost four in a row and six of seven after an 11-4 start.

"We had opportunities throughout the game," Pirates manager Clint Hurdle said. "We had a rough week. We need a day off and figure things out and show up ready to play Tuesday."

Elias Diaz hit a two-run homer for Pittsburgh.

Pirates starter Trevor Williams allowed two runs and only one hit — an RBI double to pitcher Nick Pivetta — in six innings. He had five walks and fanned seven.

Pivetta gave up two runs and five hits, striking out seven in 6 1/3 innings.

After Diaz went deep to give the Pirates a 2-0 lead in the top of the fifth, Pivetta helped himself. He lined a run-scoring double down the right-field line — his first career extra-base hit.

Pivetta scurried to third base on a wild pitch and hustled home on Cesar Hernandez's sacrifice fly that tied it at 2.

"I was just trying to get the two runs I gave up back," Pivetta said.

Phillies reliever Victor Arano had retired all 25 batters he faced this season and 32 straight, dating to last season, before Starling Marte reached safely on third baseman Scott Kingery's throwing error to start the ninth. Arano pitched out of a jam in the 10th after pinch-hitter Josh Bell hit a triple with one out.

Yacksel Rios (3-0) tossed a scoreless inning, stranding two runners, to earn the win.

STREAKING

Philadelphia's Odubel Herrera has reached base safely in a career-best 23 straight games.

TRAINER'S ROOM

Phillies: Reliever Tommy Hunter was activated from the disabled list. The righty had been sidelined all season with a strained right hamstring. He tossed a perfect eighth with one strikeout.

UP NEXT

Pirates: RHP Chad Kuhl (2-1, 4.57 ERA) opposes Tigers RHP Jordan Zimmermann (1-0, 7.71 ERA) Tuesday night in the start of a three-game set in Pittsburgh.

Phillies: RHP Vince Velasquez (1-2, 3.80 ERA) starts Tuesday night vs. Diamondbacks LHP Robbie Ray (2-0, 4.98) in the opener of a three-game series.

___

More AP baseball: https://apnews.com/tag/MLBbaseball