It took nearly four hours, two huge pinch hits and five relievers throwing a total of 85 pitches to get 12 outs, but the Phillies walked out of Nationals Park on Tuesday night with a 6-2 victory over Washington that stopped the bleeding from their consecutive losses in Atlanta over the weekend.

“It was nice to come off the bench and help the team,” backup catcher Andrew Knapp said after delivering a two-run, pinch-hit single that gave the Phillies a four-run cushion in the top of the eighth inning.

Knapp hit for J.T. Realmuto after the All-Star catcher took a foul ball off his left knee in the bottom of the seventh inning. Knapp said he spoke to Realmuto after the game.

“Yeah, he’s feeling good,” Knapp said. “It just got him in a weird spot in between the pads. I’ve actually had that before. You can’t really do much about it. You just try to work on the swelling and get some fluids in you, but he’s doing good.”

Alec Bohm, who was not in the starting lineup for just the second time this season, had contributed the first big pinch-hit of the eighth inning, an RBI double to right-center field.

The Phillies improved to 19-17, but remained a game behind the first-place New York Mets, who rallied for a 3-2 walk-off victory against Baltimore.

You’re signed up to get this newsletter in your inbox every weekday morning during the season. If you like what you’re reading, tell your friends it’s free to sign up here. I want to know what you think, what we should add, and what you want to read, so send me feedback by email or on Twitter @brookob. Thank you for reading.

— Bob Brookover (extrainnings@inquirer.com)

» READ MORE: Phillies outlast Nationals, 6-2, as Andrew Knapp comes on for injured J.T. Realmuto and delivers clutch hit

A strong start for Anderson ... until the sixth inning

Chase Anderson gave the Phillies five sensational innings Tuesday night at Nationals Park.

After allowing consecutive singles to Trea Turner and Juan Soto to start the game, Anderson retired 15 of the next 16 batters he faced, with the only hiccup coming when he hit Kyle Schwarber with a pitch in the fourth inning.

He was so good that when it was his turn to bat with the bases loaded and nobody out in the top of the sixth inning, manager Joe Girardi did not hesitate in his decision to send his starting pitcher to the plate. The Phillies were leading, 3-0, at the time.

“I mean, he hadn’t given up a hit since the first inning,” Girardi said. “Bases were loaded, there was nobody out and if he doesn’t get a hit or do something, we still have two more chances. I liked the way he was pitching.”

Anderson lined out to left field, and the Phillies ended up not scoring in the sixth.

It got worse in the bottom of the inning when Turner hit Anderson’s first pitch for a solo home run deep into the left-field seats and Soto followed with a walk. That marked the end of Anderson’s outing, and by the time Sam Coonrod escaped the sixth inning, the Nationals had cut the Phillies’ lead to a single run when Schwarber finished off an 11-pitch at-bat with an RBI single to center field.

It was the seventh time in as many starts that Anderson failed to get an out after the fifth inning. He has completed five innings in only three of his seven starts. Vince Velasquez, who has replaced Matt Moore in the rotation, has pitched into the sixth inning in his last two starts while allowing just a single run, but those are the only two times in 14 starts the Phillies have received more than five innings from the bottom two spots in their rotation. The bottom two spots have provided less than five innings eight times.

Anderson thought he made progress in his latest outing, but he said he still has work to do.

“I worked on a few things ... to kind of get back on track where I know I can be consistent as a starting pitcher,” he said. Pitching coach Caleb Cotham “and I have been working tirelessly on the side sessions and throwing program, and I adjusted a couple of minor things. It was good to see them pay off a little bit tonight. I still couldn’t get the [fastball] where I wanted it — down and away to righties. If I can get there, I can pitch into the eighth for sure.”

Anderson got his second win in his last three starts and lowered his season ERA to 5.23.

Girardi said the Phillies’ bullpen can handle the five-inning starts, but admitted it makes it tough at times.

“Yeah, I mean I think we have enough depth down there and people that can give us multiple innings,” Girardi said. “It’s OK. Our bullpen had to really work hard tonight. That’s why I was trying to get [Anderson] through the sixth. We weren’t able to do it. I thought he threw some strikes to Soto that weren’t called that maybe changes the complexion of it. But you know it’s a lot of pitches for a bullpen. Thank God we had a day off.”

The Phillies could have a rotation option at some point in the not-too-distant future because Spencer Howard is throwing the ball well for triple-A Lehigh Valley. Howard pitched three hitless innings Tuesday night during the IronPigs’ 6-0 win over Scranton/Wilkes-Barre. He walked one and struck out three, throwing 27 of his 40 pitches for strikes. In two outings, he has pitched five scoreless innings and allowed just one hit.

Even if the Phillies decide to insert Howard into their rotation, however, it might not solve their length issue because they are on record as saying they want to limit their top pitching prospect’s innings this season.

The rundown

Third baseman Bohm was not in the starting lineup Tuesday because Girardi felt he needed rest. Bohm did, however, deliver a huge pinch-hit RBI single during the Phillies’ three-run eighth inning.

Matt Breen makes a solid case for why the Phillies should pursue Chicago Cubs slugger Kris Bryant in a trade.

Important dates

Tonight: Zack Wheeler goes against Jon Lester, 7:05 p.m.

Tomorrow: Zach Eflin opposes Patrick Corbin in D.C. series finale, 1:05 p.m.

Friday: Vince Velasquez pitches series opener against Toronto Blue Jays in Dunedin, Fla., 7:37 p.m.

Monday: Off day.

Tuesday: Phillies return home for start of a three-game series against Miami, 7:05 p.m.

» READ MORE: The Phillies’ problem isn’t Neris, Hoskins, or Nola. It’s not producing more players like them. | Scott Lauber

Stat of the day

On a night when there were a bunch of really good at-bats, Odubel Herrera had four of his own as he continues to make his case to be the team’s center fielder.

Herrera walked in the second inning, led off the fourth with a line-drive double and scored on a sacrifice fly by Andrew McCutchen, walked again in the sixth inning to load the bases with nobody out, and doubled for a second time before scoring on Bohm’s pinch-hit double in the eighth. He finished the night 2-for-3, improving his season average to .209.

Since starting 0-for-12 in his first four games, Herrera has gone 9-for-31 (.290) and restored a sense of competency to the center-field position.

From the mailbag

Send questions by email or on Twitter @brookob.

Question: Will they give Zach Eflin an extension? — David L., via Twitter

Answer: I don’t think the Phillies will do anything with Eflin this season because he has one more year of salary arbitration remaining, but if he continues to pitch the way he has so far this year, there will likely be talk about an extension during the offseason.

It seems like Eflin has been around a long time, but the fact that he’s only 27 and will remain that age until next April makes him even more attractive when talking about a long-term deal.