Khazri, the Tunisia midfielder, set up Florian Thauvin for the opener on the stroke of half-time following a 50-metre run then put Anthony Modeste through in the box in the 56th after Lisandro Lopez had levelled two minutes earlier.
Thauvin scored his second just after the hour following a fine team move and Khazri found the top corner with a splendid curling shot to wrap it up with three minutes left.
"I don't know how to explain what happened in the first half," Lyon's captain, Maxime Gonalons, who was playing his 100th league game, told Canal Plus.
"We were badly positioned on their goal. We tried to bounce back after the break but we made too many mistakes tonight.
"We have never said we were chasing the title. We have a very young squad, we lack experience. We will fight to keep the second spot, we'll do everything."
Marseille occupy the third and final Champions League qualifying berth on 51 points after they could manage only a goalless home draw against Ajaccio on Friday.
Saint-Etienne and fifth-ranked Nice are on 48, two ahead of sixth-placed Lille, whose five-game winning run ended with a 2-1 shock home defeat to strugglers Evian Thonon Gaillard.
The 2011 champions had seemed to be on their way to fourth spot when Salomon Kalou opened the scoring from close range after seven minutes.
However, after Saber Khlifa netted a 30th-minute equaliser, the night turned into a nightmare for Kalou. The former Chelsea player diverted a Djakaridja Kone header into his own net in the 68th then missed from the penalty spot five minutes later.
In the the day's early kick-off, Bastia, who had already conceded 52 goals before the game, surrendered possession and banked on tight defence and their forwards' pace on the counter-attack.
It paid off. Lyon seldom threatened goalkeeper Mickael Landreau and struggled to control Khazri.
Though Lisandro made it 1-1 from close range following a Yoann Gourcuff free-kick in the 54th, Lyon collapsed when Modeste put the hosts back in front by converting a Khazri low pass.
Thauvin took advantage of Lyon's lethargy to add the third and Khazri completed his side's fine work as 14th-placed Bastia moved six points above the relegation zone on 33.
Elsewhere, the 17-year-old Corentin Jean, who had scored his first two league goals last weekend, fired home to earn second-from-bottom Troyes a 1-1 draw at champions Montpellier.
Get the best features, fun and footballing frolics straight to your inbox every week.
Thank you for signing up to Four Four Two. You will receive a verification email shortly.
There was a problem. Please refresh the page and try again.