The visitors started well with Rafael Leao's opener in the fourth minute but were reduced to 10 men after Jose Fonte's expulsion in the 16th minute.
Despite the setback, Bamba doubled his side's lead just four minutes before half-time.
The Ivorian increased his tally to eight goals for the Great Danes as he continues his impressive form this season.
After the restart, Bamba set Pepe up for Lille's third goal in the 66th minute.
The effort put him levelled as joint top scorer in the Ligue 1 alongside Kylian Mbappe and Emiliano Sala with 12 goals in 18 games.
Two minutes later, Morocco's Alioui, introduced as a 47th-minute substitute, pulled a goal back for Nimes before Clement Depres reduced the deficit for the hosts with a late effort.
The win moved Lille to the second spot in the French top-flight with 34 points from 18 games.