PITTSBURGH — The Phillies had the makings of a rally on Sunday afternoon when Rhys Hoskins and Odubel Herrera reached base to start the sixth inning.

They were down three runs, but more than half of the Phillies' wins this season have started with a deficit. This felt like another come-from-behind win.

"It felt like it was going to be," Gabe Kapler said.

But as quickly as that feeling surfaced, it was gone. Carlos Santana popped up in foul territory. Nick Williams went down swinging. Scott Kingery struck out.

The rally was over and the Phillies were three outs closer to a 4-1 loss to the Pirates at PNC Park. The offense stalled on Sunday after scoring 17 runs on Friday and rallying for a late win on Saturday. The Phillies finished a win shy of their first sweep ever at PNC Park and their first sweep in Pittsburgh since 1998 at Three Rivers Stadium. It was the Phillies' first loss of the month, snapping a six-game winning streak.

Drew Anderson, who would spend less than 24 hours in the majors, was roughed up in his first major-league start and the Phillies mustered just four hits. They opted to start Anderson and save Zach Eflin and Aaron Nola for Monday's doubleheader with the Mets. The loss on Sunday was a bit easier to swallow as the Phillies remained in first place with Atlanta's loss and flew to New York knowing that their two best pitchers were starting on Monday.

"It's a great opportunity to go in and win two ball games and kind of show everyone we're really here to stay," said Andrew Knapp, who became the first Phillies catcher to ever bat leadoff. "Those guys don't need to do anything special. Just keep doing what they've been doing and go from there."

Anderson allowed four runs in five innings. He arrived in Pittsburgh at 11:30 on Saturday night and was optioned back to triple A at 5 p.m. on Sunday. He struck out four and walked one, but he did succeed in lasting at least five innings to give the Phillies a chance. The righthander was an out away from finishing a scoreless fourth inning before Nick Kingham, the opposing pitcher, lifted a two-run double over the head of Hoskins in left field.

The Pirates tacked on another run to cap a three-run rally after Williams homered to tie the score at 1-1 in the top of fourth. The Phillies needed Anderson to give them a shutdown inning and he came up one pitch short. Anderson threw a flat slider instead of challenging Kingham with a fastball. The slider stayed up and in instead of breaking low and away. Kingham, who was hitless in his previous 12 at-bats, jumped on it. Anderson said it was "upsetting."

"Did I like the pitch call? I love an executed slider in that situation," Kapler said. "For me it's mostly about execution of pitches rather than pitch calls, right? Every one in a while there's a misguided pitch call, but in this case I think it was just about execution. Drew made a lot of good pitches today, a lot of good fastballs down and away. Had life on his fastball, threw some really cool curveballs that kept them off balance. And this wasn't his best pitch."

The Phillies failed to recover. They went 0 for 8 with runners in scoring position and Williams' homer was their lone extra-base hit. No player had more than one hit. They struck out 12 times and walked just once. The lineup seemed to lack a pulse. And three innings after their rally stalled, fireworks shot up from behind center field. The Pirates finally had a reason to celebrate and the Phillies, after a strong start to July, could live with that.

"A series win is huge," Knapp said. "We were hoping for a sweep, but to win every game except for one against that team is a huge feat for us. I think we're going to take this series win into New York and keep playing good ball."