Swept in the two-game series, Texas dropped to 0-5 against NL opponents this year. The Rangers have lost a team-record nine straight interleague games overall - their next try to end the drought will be June 1 at Colorado.
"Today wasn't a great game," Texas manager Chris Woodward said. "Today we didn't play our typical game. Typically, we play pretty good defense, we don't walk guys, and we kind of did that today. We didn't really get much going offensively."
Mike Yastrzemski and Brandon Belt drove in runs for San Francisco, which began the day tied with St. Louis for the best record in the National League.
David Dahl launched his third home run of the season for Texas.
Webb (2-3) allowed two runs and three hits to earn his first win in his last three starts. Jake McGee pitched a perfect ninth inning for his 10th save.
"I thought Webby did a fine job today," Giants manager Gabe Kapler said. "I don't think today was his best, but certainly he came out of it with a strong outing and a win, and that's what's most important."
Added Webb: "I was just like, all right, let's start getting some quick outs and start attacking these guys. And when I did that, obviously the strikeouts started to kind of pile up, so I was happy with that."
Jordan Lyles (1-3) gave up two runs in five innings, striking out six. He has lost three straight decisions since he won his first start of the season on April 4.
Texas took a 1-0 lead in the first on Joey Gallo's RBI grounder.
San Francisco answered with two runs in the bottom half on an RBI double by Yastrzemski and a single by Belt.
The Giants added two more runs in the sixth on a throwing error by Rangers third baseman Charlie Culberson.
Dahl homered to left-center in the seventh to cut San Francisco's lead to 4-2, but the Giants bullpen pitched three scoreless innings to preserve the win.
Texas finished the game 0 for 6 with runners in scoring position.
HOME SWEET HOME
The Giants have won five of their last six games at Oracle Park and own the best home record in MLB at 14-4. San Francisco is just 8-10 on the road, with an eight-game road trip beginning Thursday in Pittsburgh.
Rangers: C Jose Trevino missed his second straight game with soreness in his right triceps. Woodward said that Trevino was available off the bench but was hoping to get him some extra rest ahead of Wednesday's off day.
Giants: Belt left the game in the eighth inning with mild tightness in his left side. Kapler called it precautionary and didn't expect Belt to miss additional time. ... 2B Donovan Solano (calf strain) took batting practice and groundballs on Monday and will likely head out on a rehab assignment sometime during the Giants' upcoming road trip. Solano has been on the injured list since April 22.
Rangers: Open a four-game series at Houston on Thursday night. RHP Mike Foltynewicz (1-3, 4.50 ERA) will make his first career start against the Astros, where he began his career.
Giants: RHP Anthony DeSclafani (2-1, 2.40 ERA) will start the opener of a four-game series in Pittsburgh on Thursday night.
Webb racks up 10 Ks in Giants' win vs. Rangers
Logan Webb puts in six innings of work from the bump and records 10 strikeouts as the Giants go on to win 4-2 over the Rangers.