Carlos Correa reached on an infield single to start the inning, Houston's first hit since the seventh. One out later, Gonzalez sent one into the seats in right field off Cody Anderson (0-3) to hand Houston its third victory in five games.
Michael Feliz (1-0) allowed one hit in three scoreless innings for the win.
Anderson yielded two hits, two runs and struck out four over 3 1/3 innings in his first career relief appearance.
The game matched Washington's 6-5 victory over Minnesota in 16 innings on April 24 for the longest in the majors this season.
The teams combined to use 18 pitchers who threw 489 pitches in an endurance test that lasted 5 hours, 9 minutes. Cleveland used nine relievers after starter Danny Salazar was replaced after five innings. Houston sent out seven relievers after Doug Fister was lifted to start the eighth.
The Indians fanned 18 and walked 12, both season highs.
Houston went 2 for 15 with runners in scoring position and left a season-high 17 runners on base.
The Indians got a pair of singles in the 10th and one in the 11th, 13th and 16th but left all those runners stranded.
Jason Kipnis tied a career high with five hits and had an RBI, and Napoli hit a solo home run to put Cleveland up 2-0 in the fourth.
The Astros had plenty of baserunners early but weren't able to score until George Springer's solo homer in the fourth inning. They tied it in the sixth on an RBI single by Correa.
Springer walked a career-high four times.
Preston Tucker's RBI single put Houston up 3-2 in the seventh, but the Astros didn't get another hit until Correa's in the 16th.
Springer snapped an 0-for-12 skid when he hit Houston's 1,500th home run in Minute Maid park off Salazar, a solo shot that cut the lead to 2-1 with two outs in the fourth. Altuve doubled with two outs in the sixth before a walk by Springer. The single by Correa sent Altuve home to tie it at 2.
Fister yielded six hits and two runs in a season-high seven innings. Luke Gregerson allowed the run in the ninth for his first blown save this season.
Salazar gave up four hits and one run while fanning a season-high 10 in five innings.
Houston loaded the bases with no outs in the first inning, but Salazar worked his way out of that jam by striking out the next three batters.
The Astros loaded the bases again with two outs in the second before Correa grounded out.