South Sudan 3-2 Congo-Brazzaville
South Sudan, who were out of the running, ended ten-man Congo-Brazzaville's chances of qualifying after a 3-2 win in the penultimate match in Group K at Juba Stadium.
Christopher Ibayi broke the deadlock for Congo just before the hour-mark but Ebon Ezibon levelled matters for Sudan moments later.
Ibayi restored the lead for the visitors and grabbed his brace ten minutes before the interval but Ezibon equalised again for Sudan and completed his brace.
The Leopards were reduced to ten men 12 minutes before time after Bryan Passi was red-carded.
Data Elly eventually snatched the winner for The Bright Stars with six minutes remaining.
Both Congo and Sudan cannot qualify, left with one match, lying third and fourth in the group.
As a result, Uganda and Bafana Bafana qualified before they clash on Friday.
Equatorial Guinea 0-0 Algeria
Algeria, who had already qualified, dropped points for the first time in Group E after a goalless draw against Equatorial Guinea at Nuevo Estadio de Malabo.
Algeria are guaranteed to finish top of the table with one last match remaining.
Equatorial Guinea, meanwhile, qualified in second place in the group with a game to spare, as they are four points clear of third-placed Liberia, who also have one last match to play.
Rwanda 0-1 Libya
Libya revived their chances of qualifying with a match to spare in Group D after a narrow 1-0 win over Rwanda at Stade Amahoro.
After a goalless first stanza, Fahd Saad Mohamed broke the deadlock for Libya and ultimately the winner six minutes before time.
The Mediterranean Knights got their first victory and go into the last game against Benin with a chance to qualify.
The Wasps will also be vying to qualify for the tournament in Morocco in their last group game against Nigeria.
Benin 1-1 Nigeria
Nigeria qualified with a game to spare in Group D after a 1-1 draw against Benin at Stade Félix Houphouët-Boigny.
Mohamed Tijani gave Benin an early lead but Victor Osimhen levelles matters for The Super Eagles nine minutes before time.
Nigeria secured top spot with a match to spare while Benin remained in second spot and will fight to qualify in the last game against Libya.
Burkina Faso 0-1 Senegal
Group L leaders Senegal remained unbeaten after edging Burkina Faso 1-0 in the penultimate game at Stade du 26 Mars.
The sides went to the interval deadlocked and Habib Diarra only broke the deadlock for Senegal seven minutes before time.
The Lions of Teranga extended their lead at the top of the section to three points over second-placed The Stallions.
Both sides are through to the finals.