In-form striker Pepe, who has been linked with Arsenal, conjured up memories of France great Thierry Henry by running with the ball from inside his own half and curling home from just inside the area.
The 23-year-old Ivory Coast international's 37th-minute strike was his 16th in the league this season, with only Paris St Germain's World Cup winner Kylian Mbappe having managed more.
Second-placed Lille were already a goal ahead at that point after Portugal Under-21 international Rafael Leao fired into the top right corner inside seven minutes.
Pepe, who also hit a post late on, helped put the result beyond doubt 15 minutes from time, crossing for Jonathan Bamba to convert his ninth league goal of the campaign into the bottom right corner.
Nice, managed by Patrick Vieira, saw their miserable evening compounded when attacking midfielder Pierre Lees-Melou was sent off for a dangerous tackle in the 89th minute.
Substitute Loic Remy then nodded home against his former club in stoppage time to complete a convincing win which leaves Lille 10 points behind runaway leaders PSG.