The Mercedes driver headed his McLaren rival by a meagre 0.058s at the end of Thursday’s running.
The second day of testing included a race run and pit stop simulations for Piastri.
“Another productive day,” said Piastri, who completed 86 laps.
“With each day at these tests, we’re learning more about the car.
“We focused on some race preparation running this afternoon, seeing where we can find performance, which went well and we made some good improvements as a result.
“There’s still lots of performance to find, which is the case for every team on the grid, but overall, a smooth day.
“I’m looking forward to getting back on track in the morning to finish out testing.”
Max Verstappen has the Red Bull RB20 to himself on day two, completing 139 laps on his way to third while Ferrari’s Charles Leclerc wound up fourth.
Last year’s champion Lando Norris topped the morning session before his time was topped in the cooler evening conditions.
“We made some more good steps today,” said Norris after logging 72 laps.
“We’re gaining more and more understanding of the tyres, the balance and the strengths and weaknesses of our cars.
“From a tyre perspective, the running of the same sets of tyres on both long and short runs to see how they perform was useful for our learning.
“It was also good to try the start procedure in these new regulation cars at the end of the morning session.
“One more session of running tomorrow before we go racing, but I am feeling more confident.”
How to watch F1 pre-season testing: TV times, schedule, driver line-ups
The afternoon session, which began at 3pm local time, was stopped when Fernando Alonso’s Aston Martin AMR26 suffered a power unit-related issue.
“It was not the easiest day with a few disruptions,” said Alonso.
“It was important to get some mileage in, but it wasn’t enough, and we couldn’t complete our run plan due to a PU-related issue that caused an early finish to the afternoon session.
“There are many things we need to fix, but I know everyone at the track and at the AMR Technology Campus is working at 100 percent capacity to find solutions.”
Testing will continue on Friday.
Results: Formula 1 Bahrain Pre-Season Test Day 2
| Pos | Num | Driver | Team | Laps | Lap | Diff | Gap |
| 1 | 12 | Kimi Antonelli | Mercedes | 79 | 1:32.803 | ||
| 2 | 81 | Oscar Piastri | McLaren | 86 | 1:32.861 | 0.058 | 0.058 |
| 3 | 3 | Max Verstappen | Red Bull Racing | 139 | 1:33.162 | 0.359 | 0.301 |
| 4 | 44 | Lewis Hamilton | Ferrari | 78 | 1:33.408 | 0.605 | 0.246 |
| 5 | 1 | Lando Norris | McLaren | 72 | 1:33.453 | 0.650 | 0.045 |
| 6 | 43 | Franco Colapinto | Alpine | 120 | 1:33.818 | 1.015 | 0.365 |
| 7 | 27 | Nico Hulkenberg | Audi | 73 | 1:33.987 | 1.184 | 0.169 |
| 8 | 63 | George Russell | Mercedes | 77 | 1:34.111 | 1.308 | 0.124 |
| 9 | 31 | Esteban Ocon | Haas F1 Team | 58 | 1:34.201 | 1.398 | 0.090 |
| 10 | 30 | Liam Lawson | Racing Bulls | 106 | 1:34.532 | 1.729 | 0.331 |
| 11 | 23 | Alexander Rossi | Williams | 117 | 1:34.555 | 1.752 | 0.023 |
| 12 | 5 | Gabriel Bortoletto | Audi | 29 | 1:35.263 | 2.460 | 0.708 |
| 13 | 87 | Oliver Bearman | Haas F1 Team | 69 | 1:35.279 | 2.476 | 0.016 |
| 14 | 11 | Sergio Perez | Cadillac | 50 | 1:35.369 | 2.566 | 0.090 |
| 15 | 14 | Fernando Alonso | Aston Martin | 68 | 1:37.472 | 4.669 | 2.103 |
| 16 | 77 | Valtteri Bottas | Cadillac | 58 | 1:40.193 | 7.39 | 2.721 |
| 17 | 6 | Isak Hadjar | Red Bull Racing | No time | |||
| 18 | 10 | Pierre Gasly | Alpine | No time | |||
| 19 | 16 | Charles Leclerc | Ferrari | No time | |||
| 20 | 18 | Lance Stroll | Aston Martin | No time | |||
| 21 | 41 | Arvid Lindblad | Racing Bulls | No time | |||
| 22 | 55 | Carlos Sainz | Williams | No time |