Egypt saw off Sudan 1-0 in their final Group D game in Yaounde on Wednesday, confirming their place in the round of 16 after qualifying second in the group behind Nigeria.
Defender Mohamed Abdelmonem headed home a corner on 35 minutes after a period of sustained pressure for Egypt.
Nigeria won 2-0 against Guinea-Bissau in the other group game having already qualified for the last 16 as group winner.
Nigeria had second-half goals by Umar Sadiq and William Troost-Ekong and are the only team to come through the group stage with three wins.
Egypt would no doubt have had nerves jangling after witnessing the fate of some of their fellow former champions in Cameroon.
Defending champion Algeria were beaten 1-0 by Equatorial Guinea on Sunday in a result that seemed certain to be the shock of the tournament until four-time winner Ghana's jaw-dropping elimination at the hands of tournament debutant and tiny island nation Comoros on Tuesday.
Egypt had underwhelmed in their start in Cameroon, losing to Nigeria and then only scraping past Guinea-Bissau in their second group game, thanks to Mohamed Salah's goal and a brilliant late equaliser by Guinea-Bissau being contentiously disallowed.
Egypt still aren't in top gear but there were better signs against Sudan.
Mostafa Mohamed and Abdallah Said were both denied by Sudan goalkeeper Mohamed Mustafa in the first half.
Salah showed some of his best skill this tournament as he weaved past defenders and let off a low shot that was saved by Ali Abu Eshrein, who came on in place of Mustafa.
Salah also set up Amr el-Solia in front of goal. El-Solia blazed his shot over.
The game was something of a derby because the two countries are neighbours. But they are not close on recent achievements.
Egypt are record seven-time African Cup winners, while Sudan won the title in 1970 but have gone past the group stage just once in the 52 years since then.
The two results on Tuesday also meant Cape Verde and Malawi qualified as the first two of four best third-place teams. It's the first time Malawi has reached the knockouts at the African Cup.