The All-Star outfielder was 0 for 4 with two strikeouts in his debut with the defending World Series champions, who won two of three against the major league-leading Phillies in a rematch of the NLCS.
Lincecum and Matt Cain dominated the Phillies last October, and they did so again in this series.
"Our pitchers did a great job and we got the hits when we needed," manager Bruce Bochy said. "They're a great club."
Lincecum (9-8) showed no negative effects from the stomach illness that forced him to push his start back two days. The two-time NL Cy Young Award winner allowed three hits, struck out six and worked around four walks.
"I felt fine, a little fatigued but I just tried to keep a good pace," Lincecum said.
The Phillies hadn't lost consecutive games since June 4. They went a club-record 45 straight games without dropping two straight.
Sandoval gave the NL West leaders a 1-0 lead when he led off the second inning with an opposite-field shot to left. It was Sandoval's 10th homer, becoming the first Giant to reach double digits this season. Beltran hit 15 for the Mets before he was traded to San Francisco for pitching prospect Zack Wheeler.
The addition of Beltran should bolster a sagging offense that's near the bottom in the major statistical categories. Beltran started in right field and batted third. He contributed defensively, making a sliding catch to rob Jimmy Rollins of a hit on a shallow fly in the fifth. Beltran's streak of reaching base safely was snapped at 32 games.
"I'm not going to lie. I took a deep breath when I saw him slide and the turf flew up," Bochy said of Beltran's catch. "He plays hard. That's how he is. He's very athletic."
Phillies starter Kyle Kendrick (5-5) gave up four runs -- three earned -- and six hits in 6 1/3 innings.
In the seventh, the Giants had runners at first and third with one out when pinch-hitter Aaron Rowand hit a grounder to third. Michael Martinez bobbled it and then made a wild throw to first base. Schierholtz scored from third and Chris Stewart came all the way around from first, sliding in safely on a close play at the plate to make it 4-0.
Brian Wilson finished for his 33rd save in 37 chances.
Before the at-bat against Affeldt, Utley had stranded five runners, including three in scoring position, in his first three times up.
The Phillies had a runner on third with one out in the first after Rollins led off with a double and advanced on a bunt. But Utley popped out to shortstop and Ryan Howard struck out. Utley struck out with men on first and third to end the third. He struck out with two runners on to end the fifth.
"We can beat them," Phillies manager Charlie Manuel said. "I know we can. They're not in our head."
A crowd of 45,646 on Fireworks Night was the 192nd straight sellout, including postseason play, at Citizens Bank Park. They gave Beltran an earful of boos when he batted in the first.
Roy Oswalt (back) is expected to make another rehab start before possibly rejoining Philadelphia's rotation. ... All-Star 3B Placido Polanco is moving closer toward returning to the Phillies. He's scheduled to play nine innings for Triple-A Lehigh Valley on Friday. ... Rollins snapped an 0-for-19 slump with his double. ... The Giants designated INF Bill Hall for assignment and optioned UTL Emmanuel Burriss to Triple-A Fresno. ... San Francisco is 8-1 in rubber games of series.
Dodgers' Cody Bellinger ready for 'once-in-a-lifetime' season
Cody Bellinger, the reigning National League MVP, said he's ready for a "weird" year.
2020 MLB season at a glance: Opening Day schedule, previews, picks and more
The schedule is set, the players are in camp and we're ready for some baseball. Here's what you need to know about the 2020 season.
Phillies All-Star catcher J.T. Realmuto 'not too worried' about next contract
Eligible for free agency after this season, Phillies catcher J.T. Realmuto said Thursday that he's not worried about what the future holds despite the possibility that the coronavirus pandemic could affect salaries going forward.
Angels' Anthony Rendon wants music over 'dumb' piped-in fan noise
Angels third baseman Anthony Rendon said he thinks using piped-in an noise for games in empty stadiums is "stupid" and would prefer silence or music instead.
Indians' Franmil Reyes apologizes for not wearning mask, not socially distancing
Indians OF Franmil Reyes says he learned from what happened over the weekend and vowed to not do it again.
All 30 teams open April 1 on 2021 MLB schedule
Major League Baseball will open the 2021 season on April 1 and hopes to have every team play its first game on the same day for the first time since 1968.