Switzerland forward Okafor forced home his fifth league goal of the season with two minutes remaining, pushing Milan up to 56 points in third place and further strengthening his team's position in Italy's Champions League spots.
Stefano Pioli's Milan are still 13 points behind league leaders Inter Milan, who host Genoa on Monday, but are just one behind second-placed Juventus. Juve are at Napoli in Sunday night's big game and have Milan breathing down their necks after a poor recent run of form.
Okafor's strike was the most exciting moment of football in a niggly game in which Lazio had two players sent off in stoppage time, with a cascade of boos from dumbfounded home fans greeting the final whistle.
"It's was a game with a lot of fouls, we didn't have much rhythm," said Pioli to 'DAZN'. Friday's win also moved Milan 10 points ahead from fifth-placed Atalanta who on Sunday host Bologna, this year's surprise package in fourth.
It will make relations with Milan's American ownership slightly easier for Pioli as rumours continue to swirl about him being replaced in the summer after owner Gerry Cardinale said he was "not satisfied" on Thursday.
"It's a big win looking at the matches being played this weekend... we're trying to make this season a positive one as we still have big goals to reach," added Pioli.
Lazio drop down to ninth, level on 40 points with Napoli, after a defeat which was dreadful preparation for Tuesday's return leg with Bayern Munich in the Champions League last 16.
Maurizio Sarri's side lead Bayern by a single goal after winning the first leg in the Italian capital 1-0 last month and his players will need to pick themselves as they are eight points from the top four.
Lazio's task against Milan was made harder wh
Read on besoccer.com