Mike Carp’s pinch-hit single in the 10th inning gave the Boston Red Sox a 4-3 win Thursday for their second straight walk-off victory over the Chicago White Sox.

Jon Lester struck out 12 in seven innings for Boston, but fellow All-Star Koji Uehara gave up a tying homer in the ninth to pinch-hitter Conor Gillaspie — his third long ball in three games.

David Ortiz had a two-run double for the Red Sox, who ended their 3-7 homestand on an upswing before heading to Houston for their last three games prior to the All-Star break.

Pinch-hitter Daniel Nava drew a leadoff walk in the 10th and went to second on a sacrifice by Mookie Betts. Stephen Drew, in an 0-for-15 slump, was intentionally walked by Ronald Belisario (3-6).

Carp then batted for David Ross and lined a single between shortstop and third base as Nava scored the winning run for the second consecutive game.

In Boston’s 5-4 comeback victory Wednesday night, Nava doubled in Betts for the tying run in the ninth and scored on Brock Holt’s game-winning single.

Chicago had runners at first and third with two outs in the 10th, but Alexei Ramirez was retired on a grounder to pitcher Andrew Miller (3-5).

The White Sox tied it in the ninth on Gillaspie’s two-run shot just inside the right-field foul pole.

Ramirez led off the inning with an infield single — after first base umpire Cory Blaser’s out call was reversed on replay. Uehara then struck out Paul Konerko before Gillaspie, batting for Moises Sierra, tied it with his fourth homer of the year.

That left both starting pitchers, Lester and fellow lefty Jose Quintana, without a decision after outstanding outings.

Lester gave up one run, seven hits and no walks. In his last six starts, he’s 3-0 with a 1.01 ERA, 39 strikeouts, six walks and 33 hits allowed in 44 2-3 innings. He extended his streak to 45 innings without giving up a homer.

Quintana retired all 15 batters through five innings, then struggled with his control in the sixth when Boston scored three runs. That ended his streak of 20 2-3 scoreless innings and a stretch of 30 2-3 innings in which he allowed just one earned run.

Lester trailed 1-0 after three batters. Adam Eaton singled, Gordon Beckham struck out and Jose Abreu hit an RBI double over a leaping Jonny Gomes in left field. Lester then struck out Dayan Viciedo.

Lester fanned two batters in each of the first five innings and one each in the sixth and seventh before being replaced by Junichi Tazawa, who pitched a perfect eighth.

Uehara failed to hold the lead, though, his second blown save in 20 chances this season.

Boston went ahead in the sixth when the first three batters reached base on full counts.

Drew became Boston’s first runner with a walk and went to second on a walk to Ross. Jackie Bradley Jr. attempted to bunt on the first four pitches, then took a ball to bring the count to 3-2. He grounded a single to right field for Boston’s first hit, driving in Drew with the tying run.

The next two batters were retired before Ortiz’s two-run double gave Boston a 3-1 lead.

Ortiz nearly had another extra-base hit in the fourth when he drove the ball to deep center field. Eaton raced back to make the catch, then held the ball for the third out as he fell on the warning track.

NOTES: Chicago lost its second straight game after winning its previous three. … Boston scored in just five innings during the four-game series. … Chicago LHP Chris Sale won the online fan vote for the final spot on the AL All-Star team. … The Red Sox send John Lackey (9-6) to the mound against Scott Feldman (4-5) in the opener of a three-game series at Houston on Friday night. The White Sox begin a three-game series at Cleveland with Hector Noesi (3-6) pitching against Corey Kluber (8-6) of the Indians.

Join our Newsletter for the latest news right to your inbox