Tunisia scraped through the group stage and was without head coach Mondher Kebaier and a number of players for the last-16 clash on Monday (AEDT) after an outbreak of coronavirus in its camp.
However, it still managed to book a date with Burkina Faso, which overcame Gabon on penalties earlier in the day, in the next round.
Montassar Talbi had the only shot on target in a dour first half in Garoua, but Msakni's low drive skidded off the turf and into the top-right corner off Maduka Okoye's glove within two minutes of the restart.
Nigeria was reduced to 10 men in the 66th minute when substitute Alex Iwobi – who had only been on the pitch for seven minutes – had a booking upgraded to a straight red card after referee Maguette Ndiaye reviewed video footage of his tackle on Msakni
The Super Eagles upped their game as they chased an equaliser, but Moses Simon was unable to beat Bechir Ben Said and Umar Sadiq missed the target in stoppage time as they exited the tournament.