Bumgarner won his final start before the trade deadline and Yastrzemski had four hits, two RBI and scored the go-ahead run to lead the Giants to a 7-6 victory against the San Diego Padres on Sunday.
Bumgarner (6-7) had been considered a prime trade target but the Giants could be inclined to keep the ace left-hander after they've won 19 of 24 games to jump into the wild-card race. The Giants had 16 hits in beating the Padres for the seventh time in eight games since June 11, including five of six at Petco Park this month.
Bochy is retiring after this season, his 13th with the Giants after managing the Padres for 12 seasons.
He deflected talk about his career, preferring to focus on his team's recent accomplishments.
"It's these guys, I mean, what they've done to get back in this thing, the fight, how they're coming out every day and getting after it," Bochy said. "They have a lot of confidence. We got down today, we came back. We're getting contributions from everybody. It's a fun team to manage. We've got guys that complement each other well; of course the bullpen, what a job they're doing.
"I'm having a lot of fun right now."
Bumgarner said the Giants have changed the conversation with their play.
"We definitely have. That's been a pretty clear message we've created over the last month or so."
Asked if his situation has changed, Bumgarner raised his arms in the air and said, "I don't care. I've got a job to do and I'm going to do it."
Bumgarner allowed only four hits in seven innings, including a three-run homer by Hunter Renfroe two batters after he hit prized rookie Fernando Tatis Jr. with a pitch, drawing the ire of Padres fans. MadBum struck out six and walked two.
"I've always hated it when guys said, Just one mistake,' because there's a lot of mistakes and you just happen to get away with them in the course of a game," Bumgarner said. "But I felt like today's a time where I could actually say that and it makes sense. That guy's a good hitter and I should have done something else."
Will Smith pitched the ninth for his 26th save, allowing Wil Myers' two-run homer, his 13th.
Renfroe drove in four runs for San Diego, which has lost 11 of 15 games since the All-Star break.
Yastrzemski, the grandson of Hall of Famer Carl Yastrzemski, had his second four-hit game. His first was July 15 at Colorado. He made his big league debut on May 25. Buster Posey had three hits, including an RBI double in the ninth.
Yastrzemski singled off Luis Perdomo (1-3) opening the sixth, advanced on Bumgarner's sacrifice and scored the go-ahead run on Donovan Solano's single to center. Solano was thrown out trying to take second.
Yastrzemski hit a two-run double in the second and doubled and scored in the fourth.
He also leaped to make a great catch of Franmil Reyes' smash to the top of the wall in right in the sixth.
Renfroe had given the Padres a 4-2 lead with two outs in the third when he drove the first pitch he saw from Bumgarner an estimated 444 feet into the second deck in left-center, his 29th.
"That's the biggest thing, just making sure I'm on time and time up the pitcher," Renfroe said.
"Hunter has success against a lot of lefties," manager Andy Green said. "He's obviously one of the best lefties in the game, has been for a long time. Hunter picks him up well, sees him well and squares up baseballs against him."
The Giants tied it at 4 by getting four hits off Perdomo in the fourth, including RBI singles by Solano and pinch-hitter Alex Dickerson, who was picked up by the Giants on June 10 for a minor leaguer after being designated for assignment by the Padres.
Bochy noticed that Tatis slapped at Donovan Solano's leg as he was forced out at second and asked for a review after the Giants couldn't double up Manny Machado at first. The umpires ruled slide interference and Machado was ruled out to end the inning.
THE SKIPPER'S LAST PORT CALL
Bochy stayed at the team hotel Saturday night rather than at his offseason home in suburban Poway because a team production crew wanted to film him walking to the ballpark for his last game at Petco Park. "A lot of people were going to ask me, what's it going to be like coming to the ballpark, going down memory lane, whatever," Bochy said. "That's the first time I've walked from the Marriott, so it was not like I went down memory lane on that one." Bochy was pushed out by the Padres after the 2006 season -- when they made their last playoff appearance -- and hired by San Francisco, which he led to three World Series titles between 2010 and 2014.
Giants: Rookie RHP Tyler Beede (3-4, 4.85) looks to bounce back from a rough start when he's scheduled to start Tuesday night's opener of a three-game series at Philadelphia. He allowed four runs on a career-high 10 hits, including three homers, in a 4-1 loss to the Chicago Cubs on Wednesday.
Padres: Rookie RHP Chris Paddack (6-5, 2.84) is scheduled to start Monday night in the opener of a two-game home series against Baltimore.
More AP MLB: https://apnews.com/MLB and https://twitter.com/AP-Sports
Solano drives in go-ahead run for Giants
Donovan Solano hits a bloop single to drive in a run and break a 4-4 tie with the Padres.