Spaniard Lorenzo, the 2010 champion who was also quickest in Friday's final practice under the Losail floodlights, produced the fastest lap of one minute 54.634 seconds to take pole by 0.221 from Stoner.
British Tech3 Yamaha rider Cal Crutchlow was third fastest with his best ever qualifying display (1:55.022) and took the final front-row spot.
Australian Stoner has won the night race four times in the last five years, four times from pole.
"I had to push more than 100 percent to make pole position but I pushed to the limit and managed to make a perfect lap," said Lorenzo.
"We still have to improve the power on the straight and our maximum speed but in the rest of the track the bike is working really well. Tomorrow will be a tough race and tyres will be very important I think."
Yamaha's American Ben Spies qualified fourth with compatriot Nicky Hayden fifth on the Ducati.
Stoner's Spanish team mate Dani Pedrosa starts seventh while Moto2 champion and MotoGP rookie Stefan Bradl of Germany qualified ninth.
Italian great Valentino Rossi will line up in 12th place.
"To be honest, I'm disappointed," said Stoner, who struggled with a skittish and 'chattering' bike. "We started the weekend in a bit of a bad situation. We've basically gone full circle and come back to it."
"We've got a lot of work to do tonight," added the Australian, who had looked dominant in pre-season testing. "We're going to have to go across everything that we did over these last few days and try to come up with something."