David Bednar was booed off the field by the home crowd after blowing another one-run lead in the ninth inning against the San Diego Padres, and the Pittsburgh Pirates closer offered no defense.

Instead, Bednar swallowed hard and accepted the blame for failing to finish as the Pirates continued their freefall in a hellish homestand that saw them lose their fourth consecutive game and sixth in the last seven.

The Padres took advantage of Bednar’s command issues and a throwing error by shortstop Oneil Cruz to score three runs in the ninth inning and hang on for a 7-6 win to sweep the three-game series Thursday afternoon before 19,952 at PNC Park.

It was the fourth consecutive loss for the Pirates (56-58), who have dropped six of seven games since acquiring three players at the July 30 trade deadline to make a push for a wild-card playoff berth.

Instead, four of the Pirates’ past five losses have come by one run, as they dropped to 19-22 in such games this season. They are now nine games behind the first-place Milwaukee Brewers in the NL Central and fading fast in the wild-card race because of their blown leads.

“We’ve got to execute,” Pirates manager Derek Shelton said. “For these last three or four or five games, it’s executing pitches at the end of the game. That is what we have not done.”

It was the fifth blown save of the season for Bednar, who led the majors in save percentage (92.9%) last season. He also blew a ninth-inning lead Wednesday by giving up a solo home run to Jackson Merrill in the 9-8 loss, after the Pirates overcame a one-run deficit.

“That’s just unacceptable,” Bednar said. “The guys battle back both games, and it’s just a big-time letdown on my end. Today was incredibly frustrating, just a lot of free stuff, and that just can’t happen.”

Bednar entered the ninth with a 5-4 lead, only for Xander Bogaerts to hit a leadoff single and Merrill to draw a four-pitch walk. After striking out David Peralta, Bednar walked Ha-Seong Kim to load the bases.

Kyle Higashioka grounded to second for a would-be double play, but Cruz threw wide of first base for an error as Bogaerts and Merrill scored to give the Padres a 6-5 lead. Fans booed Bednar, a two-time All-Star closer, as he was pulled and walked off the field.

“It’s incredibly tough,” Bednar said. “It sucks. There’s no other way around it. These guys battled their butts off. To be in the position, up in the ninth, I should be able to convert those. And especially the past two nights, not being able to is tough. But you know what? I’m confident I’ll be able to get through this, and I’ll be able to convert this next couple.”

The bullpen has been the biggest culprit in the Pirates’ collapse, starting with the back end. After taking the loss in three games this homestand, seventh-inning setup man Colin Holderman was placed on the 15-day injured list with right wrist sprain.

Despite allowing a pair of two-run home runs, Luis Ortiz became the first Pirates starting pitcher to go six innings since July 29. Ortiz gave up three consecutive home runs in a five-run first inning in his previous start, a 9-8 loss to the Arizona Diamondbacks on Aug. 2, and has surrendered six homers over his past three starts.

Jurickson Profar, who was removed from Wednesday’s game after being hit by a pitch, was plunked again by Ortiz in his first at-bat. Manny Machado then sent a 2-2 slider 402 feet to left field for his 18th home run, giving the Padres a 2-0 lead in the first inning.

Merrill hit a leadoff single in the second before Peralta belted an 0-1 cutter on the inside corner 389 feet to right for another two-run homer as the Padres increased their lead to 4-0.

“Other than that, I thought he was really solid,” Shelton said of Ortiz, who threw 59 of his 93 pitches for strikes. “Kept us in the game, and we continued to battle back. I thought he did a nice job.”

The Pirates cut it to 4-3 in a five-hit sixth as they batted around the order. The rally started when Bryan Reynolds hit a leadoff single then scored when Cruz singled off the center-field wall. The ball ricocheted back to Merrill, who threw out Cruz as he tried to stretch it into a double. The Pirates challenged the call, but it was upheld.

That cost the Pirates a run, but they would score two more. Rowdy Tellez hit a two-out single to center, and Bryan De La Cruz ended a 1-for-20 slump with a single to right to put runners on first and third. Carl Edwards Jr. replaced Vasquez, but his wild pitch allowed Tellez to score to cut it to 4-2 and Ji Hwan Bae singled to drive in De La Cruz and make it a one-run game. When Michael A. Taylor drew a full-count walk to load the bases, the Padres turned to Yuki Matsui and the lefty reliever got Isiah Kiner-Falefa to ground out to third to end the inning.

After Cruz singled with one out in the seventh, Joey Bart blasted Matsui’s full-count fastball 419 feet to the North Side Notch for his ninth home run to give the Pirates a 5-4 lead.

“You see how it is at the end of every game,” Bart said. “There’s something about us that we keep fighting, and that’s what this team’s about. It feels like we’re a gritty team and things happen late, and sometimes we’re on the wrong end of it and sometimes we’re on the right end of it — and that’s where we want to be. All we can do is keep grinding and bring it every day, and the rest will fall in place.”

Aroldis Chapman delivered a clean eighth, striking out Machado again after getting him looking at a 104.7-mph sinker Wednesday. This time, Chapman got Machado to foul off a 102.8-mph sinker before fooling him with a 93.1-mph splitter for a swinging strikeout.

The Pirates staged a two-out rally in the ninth when Bart doubled to left-center and scored on a single down the third-base line by Tellez to cut it to 7-6. But Padres closer Robert Suarez struck out De La Cruz to end the game and earn his 25th save.

The Pirates now embark on a six-game West Coast swing, with a three-game weekend series at the Los Angeles Dodgers followed by another three-game series at the Padres. The Pirates have a better record on the road (29-27) than they do at home (27-31).

“We’re in a situation where we’ve got to keep grinding. It doesn’t get any easier,” Shelton said. “We’re doing a good job of continuing to battle back. We have the winning run or the tying run on base again tonight. The fact that we’ve had leads in four of those games on this homestand in the seventh or later, yeah it’s extremely frustrating. Not to beat a dead horse, but we’ve got to figure out a way to finish them because we have the lead and we have to be able to execute to finish games out.”

Kevin Gorman is a TribLive reporter covering the Pirates. A Baldwin native and Penn State graduate, he joined the Trib in 1999 and has covered high school sports, Pitt football and basketball and was a sports columnist for 10 years. He can be reached at kgorman@triblive.com.