The only sour note for Ferrari was the sight of Raikkonen pulling off the track towards the end of the session with a loose front-right wheel, although the Finn escaped a grid penalty.
He heads into Sunday's race on course to become the first driver since Michael Schumacher in 2004 to open the season with consecutive wins for Ferrari.
His Ferrari rival Sebastian Vettel, meanwhile, who won in Melbourne two weeks ago to take the early championship lead, will line up on pole.
Hamilton came to Bahrain knowing he was in for a five-place grid penalty for a gearbox change, so he needed to be on his game - with a ideal vehicle - to minimise the damage and give himself the best chance in the race.
"We need to wait", said Vettel.
If Gasly and Alonso's positions are repeated on Saturday in qualifying, it would be embarrassing for McLaren at the home race for their chief shareholders, the Bahraini sovereign investment fund. "First run in Q3 I was very happy and then I tossed it away last corner. I'll give it everything I've got", said the Briton.
In a further boost for Ferrari, the aging Kimi Raikkonen has looked sharp all weekend, leading the second and third practice. "If we look purely at lap times it was OK, but that doesn't tell you much; It's only the first day and it's impossible to know what the others were doing". That is one less fast vehicle in Hamilton's way as he attempts to make ground.
The Rock Is Reminding Guys That 'Depression Never Discriminates'
Dwayne Johnson: "Us guys do have this tendency to hold it in, and we don't feel comfortable talking about our feelings". He added: "What's insane about that suicide attempt is that to this day, she has no recollection of it whatsoever".
"The Ferrari was quicker today", said Bottas. I meant it. On a track like Bahrain, with a very abrasive surface, and lots of heat, we struggled.
Toro Rosso rookie Pierre Gasly is next on the grid, promising an intriguing start to Sunday's race.
The Bahrain International Circuit stretches 3.3 miles, with its layout defined by four relatively long straights that should prove a good test of the power units.
McLaren ditched the Honda engine at the end of last season claiming it was holding them back, which leaves the team facing awkward questions about the quality of their vehicle.
Williams completed the bottom of the timing screens, with Sergey Sirotkin 0.419 seconds adrift of Leclerc's Sauber in 19th while Lance Stroll finished as the slowest driver of the session in 20th, nearly three seconds off the pace.