PITTSBURGH (AP) Madison Bumgarner homered in his second straight start and struck out six in 6 1/3 innings to lift the San Francisco Giants to a 6-4 win over the Pittsburgh Pirates on Friday night.

Bumgarner crushed a Jeff Locke (6-8) fastball 418-feet over the wall in left field in the second inning, a two-run shot that gave the Giants an early four-run lead and all the cushion Bumgarner would need on the mound. Bumgarner (15-6) allowed two runs on five hits, walking one while winning his fourth consecutive decision. Santiago Castilla worked the ninth for his 30th save.

Marlon Byrd had three hits, including a two-run home run, in his debut with San Francisco after being acquired in a trade with Cincinnati on Thursday.

More from FoxSports

Michael Morse scored twice for the Pirates, who lost for just the second time in their last nine games.

The 2014 World Series MVP wasn't quite as sharp as he was in his last appearance at PNC Park, a four-hit shutout in the 2014 NL Wild Card game last fall that served as the springboard to one of the greatest postseasons in baseball history and propelled the Giants to a third championship in five years.

Then again, the way Bumgarner is swinging the bat at the moment, near perfection on the mound is hardly required. He leads all pitchers in batting average (.254), home runs (five) and RBI (nine) and even came off the bench against St. Louis on Tuesday and delivered a pinch-hit single in a 2-0 victory.

Locke did his best to nibble around Bumgarner when the pitchers squared off with a man on one out in the second, falling behind 3-0 before Bumgarner took a 3-2 offering and nearly hit it to the second deck in left to put the Giants up 5-1.

Byrd, brought over from the Reds on Wednesday to give San Francisco's injury riddled outfield a boost, wasted little time making an impact. Facing the team he helped lead to the playoffs in 2013 after arriving in a trade with the Mets, Byrd hit a deep two-run shot to left against Locke in the first. He later singled and doubled and is hitting .361 against Pittsburgh this season, with six home runs.

Given an early cushion, Bumgarner flirted with giving it away. The Pirates touched him for runs in the first and second before he settled down to retire 14 straight at one point before leaving after giving up a run in the seventh on a sacrifice fly by pinch-hitter Neil Walker.

Pittsburgh pulled within 6-4 on an RBI single by Aramis Ramirez in the eighth but reliever Josh Osich got pinch-hitter Pedro Alvarez to hit a roller to first base to help San Francisco improve to 17-3 in Bumgarner's last 20 starts in Aug. 1 or later.

JAY-HAY'S RETURN

Pittsburgh's Josh Harrison went 0 for 2 in his return from a lengthy stay on the disabled list due to surgery on his left thumb. Harrison, who went down on July 5, struck out, grounded out and was hit by a pitch before being pinch-hit for in the seventh.

TRAINER'S ROOM

Pittsburgh SS Jordy Mercer is nearing a return from a sprained left knee. He hit a home run in a rehab start for Triple-A Indianapolis on Friday.

UP NEXT

San Francisco's Mike Leake returns from a stint on the disabled list Saturday when he makes his second start for the Giants since coming over in a trade from Cincinnati. Leake strained his left hamstring in a loss to Texas on August 2. Leake is 8-3 with a 3.07 ERA in 23 starts against the Pirates.

Pittsburgh All-Star Gerrit Cole will try to break out of an August funk. Cole is 0-3 with a 4.70 ERA in four starts this month, including a 4-1 loss to Arizona on Monday.

---

Follow Will Graves at www.WillGravesAP(at)twitter.com