The Frenchman triggered a red flag when he stopped at the edge of the track and jumped out just as flames took hold.
His car had lost all electrical power in what the team described as a "blackout".
It took the marshals a few seconds to reach the car as some of them had to cross the track, and Gasly was seen urging them to take action.
They eventually put the fire out, but not before the rear of the car suffered serious damage.
Gasly was already on the limit for all six Honda power unit elements, and thus any replacements will lead to grid penalties if the team does not have serviceable examples in the pool.
He had completed 27 laps of the afternoon session before the fire, and was still an encouraging seventh at the end of the session.
However, he has some catching up to do as he only ran the hard tyre, and will have to rely on data from team mate Daniil Kvyat.
"Literally five seconds before I stopped I just lost everything," he said. "The steering, the electricity in the car.
"We're still investigating what happened. Obviously there was a lot of fire at the back of the car and things burning, so we need to analyse and know what happened.
"For sure it's not ideal, especially because we could not run the option tyre, we had only the base this morning.
"On a new track like this it's never great. But that's what we got, unfortunately. We'll try to get as much data as we can on Dany's side.
"Pace-wise it looked pretty decent all day long, but I'm still not feeling super comfortable with the car, so I think we can improve it for tomorrow. It will be important, FP3, because we need to recover these laps."