Bogaerts finished 3-for-4 while doubling his season total for home runs to four, hitting both homers off Astros right-hander Joe Musgrove (4-6).
He clubbed a two-run shot in the sixth inning to spark a four-run frame and added an RBI single in the seventh that scored Mookie Betts with what proved to be the decisive run.
While Boston (39-30) pulled into a tie atop the American League East with the New York Yankees, the Astros (46-24) dropped all three series on their nine-game homestand.
Houston clubbed three home runs, including back-to-back blasts in the sixth inning off Boston starter David Price (2-1) and reliever Heath Hembree.
While Carlos Correa (13th homer), Jake Marisnick (eighth) and George Springer (19th) all went deep, the Astros couldn't quite get over the hump, stranding 13 baserunners and going 3-for-15 with runners in scoring position.
Trailing 6-4 with Correa and Jose Altuve in scoring position in the eighth inning, Carlos Beltran drove home Correa with a single to left only for Altuve to be thrown out at the plate on a perfect toss from Andrew Benintendi.
Red Sox closer Craig Kimbrel recorded his 20th save and the game ended when Derek Fisher was thrown out by catcher Christian Vazquez trying to steal second.
Price allowed three runs and eight hits in five-plus innings. Musgrove allowed five hits and six runs in 5 2/3 innings.
Musgrove and Price labored early, with Musgrove surrendering a string of hard-hit balls before finally settling down in the third.
By then he had surrendered the first Bogaerts home run, a jarring blast to straightaway center field, and three additional hits. Then he found a rhythm with nine consecutive batters retired.
Price was even more of an adventure, allowing an RBI single to Brian McCann in the first inning, the third consecutive hit he surrendered that frame. Altuve, who doubled with one out, scored on the hit to pull Houston even.
The Astros managed three baserunners in the second inning and two more in the third but failed to score each time. It wasn't until Correa led off the fifth inning with his homer that Houston capitalized on the opportunities. But the Red Sox answered against Musgrove to make their deficit short-lived.
NOTES: Astros LHP Dallas Keuchel will begin a throwing program on Monday in Oakland by playing catch for the first time since landing on the 10-day disabled list on June 5 with neck discomfort. This is the second DL stint for Keuchel related to his neck. He will not pitch on the upcoming seven-game road trip through Oakland and Seattle. ... Red Sox LHP Eduardo Rodriguez, on the 10-day disabled list since June 2 with a right knee subluxation, completed a bullpen session without issue and will ramp up defensive work to continue reestablishing mobility. ... Astros RHP Collin McHugh will travel to Florida and begin extended spring training on Monday. McHugh has yet to pitch this season after arriving in West Palm Beach with right shoulder tendinitis and later developing a right elbow impingement in a subsequent rehab start.