Ramirez's 18th homer, a two-run shot, capped Chicago's four-run rally in the inning. Ramirez's 13 homers since June 24 are the most in the majors.
Soriano started the inning with his 15th of the season.
Cubs starter Carlos Zambrano (7-5) won for just the second time since May 26 and improved to 16-8 against Houston, the most wins against the Astros by an active pitcher.
Zambrano went six innings, allowing nine hits and two runs, striking out three and walking one.
Michael Bourn had three hits and two stolen bases.
Five Cubs relievers combined to throw three scoreless innings of relief.
Sean Marshall pitched the ninth for his third save. Carlos Marmol, the Cubs' closer for most of the season, struck out the only two batters he faced in the eighth inning.
However, the Astros failed to capitalize on some early opportunities and stranded eight runners in the game.
Zambrano fell behind Clint Barmes 3-0, but induced a double-play grounder to short, scoring Lee with the game's first run. Zambrano escaped further damage by getting Humberto Quintero on a bouncer to second.
The Astros again loaded the bases with no outs in the third.
Norris and Bourn singled and Zambrano hit Jose Altuve in the shoulder with a pitch.
Zambrano fell behind Hunter Pence 3-0, but Pence lined sharply to shallow left and Carlos Lee flew out to about the same spot, leaving the bases loaded with two outs for Wallace. Wallace flew out to right to end the inning.
The Cubs also struggled in the early going. Soriano led off the third with a double into the left-field corner. With one out, he was caught in a rundown on a comebacker hit by Zambrano. Chicago also squandered Ramirez's leadoff double in the fourth.
Houston went ahead 2-0 in the fourth when Bourn singled home Barmes.
The Astros' early failings cost them when the Cubs finally got to Norris with a four-run rally in the fifth.
Soriano cut Houston's lead to 2-1 with a leadoff homer. Chicago tied the game when Darwin Barney singled, went to second on Zambrano's bunt hit, stole third and scored on Starlin Castro's sacrifice fly.
Ramirez then hit a two-run homer into the left-field bleachers, putting the Cubs up 4-2.
NOTES: Houston reinstated outfielder Jason Bourgeois from the 15-day disabled list and optioned outfielder Brian Bogusevic to Triple-A Oklahoma City. Bourgeois had been on the disabled list since June 29 because of a strained right quad. Bourgeois struck out as a pinch-hitter in the eighth. ... Henry Sosa, acquired by the Astros from the San Francisco Giants for infielder Jeff Keppinger on Tuesday, threw seven shutout innings in his debut with Double-A Corpus Christi on Thursday night. He allowed four hits and struck out five. ... Cubs manager Mike Quade declined to pick a starter for Tuesday's game at Milwaukee, saying he wanted to see how the weekend series with Houston unfolded. Rodrigo Lopez, who has three straight quality starts, is the most likely candidate to take the turn. ... Aramis Ramirez hit his 231st homer as a member of the Cubs, tying him with Gabby Hartnett for sixth on the club's career list. ... The Cubs snapped a nine-game streak with at least one error, their longest since June 4-13, 1987. The Cubs entered the game with 87 errors on the season, 15 more than the Astros, who had the second-most in the National League.