Sainz's team-mate Charles Leclerc topped a curtailed morning session, which was halted with 1h38m on the clock after he hit a loose drain cover and forced Ferrari to change the floor on its SF-24.
The session wasn't restarted but an extra hour was added to the afternoon session instead, meaning some teams had to alter their run plans.
Sergio Perez, for example, remained aboard the Red Bull RB20 instead of handing over the reins to Max Verstappen as planned, having only been able to complete 20 laps in the morning due to a brake issue.
The additional hour saw little performance work, with only Aston Martin's Lance Stroll dramatically improving to go fourth, after which Lewis Hamilton jumped to second on his testing debut in the new Mercedes W15.
Sainz fired off the first proper lap time of the afternoon with a 1m31.856s, which propelled him into second. Just shy of the two-hour mark he then found half a second to take over the lead from team-mate Leclerc with a 1m31.397s.
The Spaniard then bolted on Pirelli's softer C4 tyres to go quicker still, his 1m30.686s and then a 1m30.424s putting him comfortably ahead of McLaren's Lando Norris.
There was a brief scare for the highly productive Perez, who after a mammoth stint on hard tyres briefly crawled to a halt, but he managed to reach the Red Bull garage under his own power.
Meanwhile Sainz went faster again, being the first driver to breach the 1m30 barrier with a 1m29.921s on the same C4, a compound which is a step softer than what will be available for next week's opening grand prix at Sakhir.
Lewis Hamilton climbed to second with a 1m31.066s on C3s, only to be demoted by Perez inside the final hour. The Mexican, who also beat Hamilton to the highest number of laps at 129, gradually improved his best effort to a 1m30.679s on C3s.
Perez and Hamilton demoted McLaren's Lando Norris to fourth after the Briton missed an hour of afternoon running due to gremlins at the rear of the MCL38.
Daniel Ricciardo was fifth for RB on C4 tyres, followed by morning runner Leclerc, Aston Martin's Lance Stroll and the Alpine of Esteban Ocon. Sauber's Valtteri Bottas and McLaren's Oscar Piastri, who also set his time in the morning, rounded out the top 10.
Along with Perez and Hamilton, Logan Sargeant also completed a full day of running aboard the Williams FW46, the American clocking the 11th-fastest time.
Aston's Fernando Alonso, Sauber man Zhou Guanyu and Alpine driver Pierre Gasly were all restricted to less than 40 laps across a curtailed morning session as they padded out the timesheets.
Haas duo Kevin Magnussen and Nico Hulkenberg remained near the bottom, with RB's Yuki Tsunoda slowest of the 17 runners.
Unlike the morning session, the afternoon running passed without notable incidents, although the session was briefly red-flagged towards the end for planned system checks by race control.
F1's pre-season will come to a close on Friday with a third and final day of testing, with the 2024 season getting underway at the same venue next week.
2024 Bahrain F1 test day two times
Pos | Driver | Team | Time | Gap | Laps | Tyres |
1 | Carlos Sainz | Ferrari | 1:29.921 | 84 | C4 | |
2 | Sergio Perez | Red Bull Racing | 1:30.679 | +0.758s | 129 | C3 |
3 | Lewis Hamilton | Mercedes | 1:31.066 | +1.145s | 123 | C3 |
4 | Lando Norris | Mclaren | 1:31.256 | +1.335s | 52 | C3 |
5 | Daniel Ricciardo | RB | 1:31.361 | +1.440s | 88 | C4 |
6 | Charles Leclerc | Ferrari | 1:31.750 | +1.829s | 54 | C3 |
7 | Lance Stroll | Aston Martin | 1:32.029 | +2.108s | 96 | C3 |
8 | Esteban Ocon | Alpine | 1:32.061 | +2.140s | 78 | C3 |
9 | Valtteri Bottas | Sauber | 1:32.227 | +2.306s | 97 | C3 |
10 | Oscar Piastri | Mclaren | 1:32.328 | +2.407s | 35 | C3 |
11 | Logan Sargeant | Williams | 1:32.578 | +2.657s | 117 | C3 |
12 | Fernando Alonso | Aston Martin | 1:33.053 | +3.132s | 31 | C3 |
13 | Zhou Guanyu | Sauber | 1:33.715 | +3.794s | 38 | C3 |
14 | Pierre Gasly | Alpine | 1:33.804 | +3.883s | 33 | C3 |
15 | Kevin Magnussen | Haas | 1:36.611 | +6.690s | 93 | C3 |
16 | Nico Hulkenberg | Haas | 1:37.509 | +7.588s | 31 | C3 |
17 | Yuki Tsunoda | RB | 1:38.074 | +8.153s | 40 | C3 |