It may have gotten a little closer than we all wanted at the end, but the Phillies hung on to beat the Baltimore Orioles, 4-3, in front of 18,133 at Citizens Bank Park.

The Phillies were sure glad to see the Orioles leave town. They arrived with the worst record in the majors but played the Phillies tough. Or maybe the Phillies just played poorly. Either or. The Orioles took the first game of the series, 2-0. The Phillies needed a walk-off, two-run triple from J.T. Realmuto to win Tuesday’s game in 10 innings. Wednesday night’s win was not easy, either. The Phillies did not put a run on the board until Andrew McCutchen smacked a two-run homer with two outs in the sixth.

The Phillies have won two in a row. They are 78-74 with 10 games to play. Wednesday night’s victory made sure that they’ll remain three games behind the first-place Atlanta Braves in the NL East, but time is running out. The Braves entered their game at Arizona on Wednesday night with a 79-70 record. Atlanta is currently beating the Diamondbacks.

Baltimore lefty Keegan Akin entered Wednesday night’s series finale 2-10 with a 6.93 ERA in 89 2/3 innings this season. He pitched a lot better than his record, but that was not a complete surprise because left-handed starters have given the Phillies trouble this season, especially recently with Rhys Hoskins out for the season.

Akin sailed through the first five innings and the Orioles took a 1-0 lead against Zack Wheeler in the top of the sixth. In the bottom of the inning, Akin gave up a one-out single to Harper and manager Brandon Hyde removed him at 90 pitches with two right-handed hitters, Realmuto and McCutchen, due up. Realmuto flew out to center, but McCutchen kept the line moving with a two-run homer against right-hander Eric Hanhold.

The lead did not last long. Joe Girardi pulled Zack Wheeler after six innings and 97 pitches — he allowed one hit and struck out nine — and Sam Coonrod gave up the tying run in the top of the seventh on a single, a walk, a wild pitch and a groundout. The wild pitch came on a very blockable ball in the dirt that went through Realmuto’s legs.

Realmuto also had a passed ball in the eighth inning that set up a run. His hands were sure moments later when he caught Harper’s throw and tagged out Pedro Severino at the plate to preserve a one-run lead.

Another great defensive play also happened in the top of the eighth. Rookie Matt Vierling started at first base and stole a hit from Ryan Mountcastle to open the eighth inning.

The Orioles scored once in that inning to make it a one-run game. The plays by Vierling and Harper minimized the damage and were huge difference makers.

Vierling had a big game outside of that one play for the Phils. He started a two-run rally in the bottom of the seventh as well and played perfect at first.

After giving up the lead in the seventh, the Phils got it back for good with two runs in the bottom of the inning. Vierling started the rally by beating out an infield hit and pinch-hitter Brad Miller followed with a double. Jean Segura broke the tie with a one-out sacrifice fly and Realmuto pushed across another run with a base hit up the middle.

The Phillies’ bullpen was thin with Archie Bradley and Hector Neris getting the night off. Jose Alvarado, Cam Bedrosian, and Ian Kennedy got the job done. Kennedy gave up a pair of two-out walks in a nervous ninth before getting the final out.