Yastrzemski hit his first leadoff homer when he drove Dylan Bundy's fastball into the right-field stands four pitches into the game. It was the right fielder's team-leading sixth homer, with all but one coming with two strikes.
Yastrzemski also made a diving catch to rob David Fletcher of an RBI single to end the second inning.
Sandoval - who came into the game batting .190 - broke a 1-1 tie in the second with a two-run shot to right-center for his first extra-base hit of the season.
''They're the type of at-bats we expect from those people. We're starting to hit that stride where our veteran players are starting to hit better,'' Giants manager Gabe Kapler said.
Tommy La Stella homered and Anthony Rendon had two hits for the Angels, who have dropped five of six.
La Stella evened the game at 1 with a homer to right-center in the first inning off Trevor Cahill. It was the second baseman's second HR in two at-bats after he had a two-run walkoff shot in Monday night's 8-6 victory.
Cahill gave up one run and four hits with four strikeouts. The 32-year-old right-hander spent last season with the Angels. Jarlin Garcia (1-1), the fifth of six San Francisco pitchers, retired the side in the eighth to get the win.
''To get four quality innings from Trevor was big. He came out throwing better,'' Kapler said. ''We also got some great work from our bullpen.''
Bundy (3-2) was the Angels' best starter the first four weeks of the season but struggled with control all day. The right-hander, who came into the game fifth in the AL with a 1.57 ERA, allowed four runs, four hits and four walks with a strikeout in four innings. The leadoff hitter reached in each frame.
''Nothing was working from the very beginning. You saw it. He didn't have the typical command of everything like he has had,'' Angels manager Joe Maddon said. ''The fastball was getting hit. He tried to elevate it a couple of times and it got whacked. There was nothing working for him today. ... It just wasn't Dylan's day.''
Brandon Belt's RBI single in the third extended San Francisco's lead to 4-1 before Brandon Crawford added a two-run double to right in the fifth.
Seven of San Francisco's 10 hits went for extra bases, including RBI doubles by Evan Longoria and Sandoval in the ninth.
Shohei Ohtani drove in Mike Trout on a groundout in the ninth inning for the Angels' other run.
TOO CLOSE FOR COMFORT
The Angels took exception to Shaun Anderson throwing two pitches near Trout's head during the ninth inning. Kapler said he wanted to get Anderson some work in the ninth because he hadn't pitched in awhile.
''I will be very direct. Scott hasn't been on the mound in five days. He was a little jumpy. We don't throw at people,'' Kapler said.
Maddon didn't see anything malicious in the matchup, but did point to Anderson's inexperience.
''That's just a young man who's not ready to be here. That's all that is,'' he said. ''That's why we've got to be careful as we move things further along that we don't bring up guys who aren't ready to particularly pitch with command because that's where people can get hurt. That's got to be watched.''
TWO STRIKES? NO PROBLEM
Yastrzemski has 13 RBIs with two strikes, which is tied with Arizona's Kole Calhoun for most in the majors. He is also hitting .300 (15 for 50) that deep in the count, with 10 of his hits going for extra bases.
It was 99 degrees at first pitch, making it only the 10th game since Angel Stadium opened in 1966 where it was 99 degrees or above at the start. The record is 108 degrees, which was set on July 6, 2018, against the Dodgers.
Giants: OF Austin Slater was out of the lineup for the third straight game due to a right elbow flexor strain. Kapler said Slater has started some throwing but might be confined to the designated hitter role for the short term.
Angels: C Jason Castro (neck stiffness) has made some progress, but there is no timetable on when he could rejoin the lineup.
The series shifts to San Francisco for the next two games. Giants RHP Johnny Cueto (1-0, 4.62 ERA) has a 16-7 career mark in interleague play, including 2-0 against the Angels. Los Angeles LHP Patrick Sandoval (0-2, 3.94 ERA) is scheduled to make his 13th major league start and is still looking for his first win.
More AP MLB: https://apnews.com/MLB and https://twitter.com/AP-Sports
Copyright 2020 STATS LLC and Associated Press. Any commercial use or distribution without the express written consent of STATS LLC and Associated Press is strictly prohibited.