Marquez spent the opening half of the afternoon session on top, and until the final five minutes he was the only rider from the top 10 in FP1 to have improved his best time.
That changed when Pramac Ducati rider Jack Miller again became the first rider to dip beneath the two-minute mark with a best lap of 1m59.771s, which was then eclipsed by a 1m59.701s from Marquez.
Malaysia Grand Prix
Vinales: Matching Rossi/Marquez was impossible
05/11/2018 AT 13:40
But Rins, having just slotted into second behind Miller, was able to find even more time on his final flying lap, turning in a 1m59.608s to best Honda rider Marquez by 0.093 seconds.
Miller's time was enough for third place, 0.163s off the pace, ahead of Phillip Island winner Maverick Vinales on the best of the Yamahas and the second Pramac Ducati of Danilo Petrucci.
Valentino Rossi enjoyed a spell at the top of the times in the second half of the session prior to Miller's improvement and in the end was sixth-fastest, failing to improve on his best effort from Friday morning.
That time still left him fourth in the combined order, behind Rins, FP1 pacesetter Andrea Dovizioso - who was only seventh in FP2 - and Marquez.
Johann Zarco (Tech3 Yamaha) and the second Suzuki of Andrea Iannone retained their places in the top 10 overall by ending up eighth and ninth, but Dani Pedrosa (Honda) was left outside the cut-off despite being 10th fastest in FP2.
Instead, Aprilia rider Aleix Espargaro remains 10th overall by virtue of his FP1 time after a session in which he finished 19th.
His team-mate Scott Redding was the only rider to crash in FP2, doing so early on at Turn 2, although Marquez saved a lurid slide at Turn 15, the final corner, not long after.
Jorge Lorenzo continued to struggle on the second of the factory Ducatis, as he elected to continue running despite ending up slowest of all in first practice.
The Spanish rider failed to improve on his FP1 time, completing only nine laps, and was once again last, five seconds off the pace.
Malaysia Grand Prix
Zarco gains pole after Marquez impeding penalty
03/11/2018 AT 12:00
Malaysia Grand Prix
Marquez claims Sepang MotoGP pole despite fall
03/11/2018 AT 10:10