Lens were down to 10 men early in the match but scored twice through Arnaud Kalimuendo and Cheick Doucoure, before Nice had Mario Lemina sent off, conceded the third and had Dante red-carded in stoppage time.
Lens, eighth on 47 points, were reduced to 10 men after 17 minutes when Massadio Haidara was shown a straight red card for stamping on Youcef Atal's knee but the hosts stayed compact and reached halftime without conceding.
Kalimuendo opened the scoring for Lens with a half volley from their first chance of the second half in the 51st minute.
Four minutes later, Doucoure made it 2-0 with an excellent right-foot shot, just before Lemina picked up his second yellow card for a foul on Doucoure.
Lens stayed solid until the final whistle with keeper Jean-Louis Leca making several superb saves.
A frustrated Dante was sent off one minute into stoppage time for a dangerous tackle on Kalimuendo.