Nigeria finished Group D with a third successive win as they beat Guinea-Bissau 2-0, leaving runners-up Egypt to face the winners of Group E in the next round, and a potential clash with the Ivorians.
Mohamed Abdelmonem's header at a corner 10 minutes before half-time in Yaounde sent the Pharaohs through and eliminated Sudan, and also saw Ivory Coast, Mali, Gambia, Malawi, and Cape Verde qualify without kicking a ball.
"I think Egypt deserved to win this game without any doubt given the opportunities we created and the football we played," said Egypt coach Carlos Queiroz.
"Our sin was not to score the second goal. If you score the second goal the game is finished. I will say it very clear, if I'll be able to win all the games 1-0 till the end I will be happy."
Egypt's victory guaranteed Cape Verde and Malawi will qualify as two of the four best third-placed sides. Ivory Coast lead Group E with four points and can finish no lower than third regardless of their result Thursday against reigning champions Algeria.
The same applies to Gambia and Mali in Group F. Both nations have four points from two games.
Three-time former winners Nigeria continued their fine start to the competition by sweeping aside Guinea-Bissau courtesy of second-half goals from Umar Sadiq and captain William Troost-Ekong.
Three in a row for Nigeria
Nigeria caretaker coach Augustine Eguavoen made eight changes to his team with top spot already secure, but it was Kelechi Iheanacho -- the match-winner against Egypt -- who supplied the cross for Sadiq to tap in on 56 minutes.
Moses Simon came off the bench and played the main role in Nigeria's second goal, twisting past two defenders in the box before hammering a shot against the crossbar.
Troost-Ekong turned in the rebound from close range, with an initial offside decision against the defender overturned by VAR.
The Super Eagles will stay in Garoua to play a third-placed team in the last 16 on Sunday.
Cape Verde will take on Sadio Mane's Senegal in Bafoussam on January 25, while Malawi will meet Morocco on the same day in Yaounde after reaching the knockout rounds for the first time.
The remaining three slots will be determined on Thursday after the final round of matches in Group E and Group F.
Algeria, whose 35-match unbeaten run was ended by Equatorial Guinea, must beat Ivory Coast in Douala to avoid a shock early exit after picking up just one point from two games.
The Equatoguineans are second in the section going into their game with Sierra Leone, who held Algeria 0-0 in their opener and then snatched an injury-time equalizer to draw 2-2 with Ivory Coast.
Tunisia could be without 12 players including skipper Wahbi Khazri against surprise Group F leaders and debutants Gambia because of Covid-19.
The Carthage Eagles, the 2004 winners, will qualify for the last 16 unless they suffer a defeat by six goals or more.