Morocco, the host nation of CHAN-2018 and a favourite for the title, will face Libya in the semi-finals on Wednesday in Casablanca, while Nigeria will face Sudan in Marrakech.
Morocco, who topped their group have so far scored nine goals scored, conceding just one in four games including six by tournament top scorer Ayoub El-Kaabi alone, will be favourites in front of their home crowd.
Libya had to contend with extra time and only got their ticket against Congo Brazzaville on penalties (5-3).
Nigeria were also pushed into extra-time on Sunday afternoon before beating Angola 2-1. The Super Eagles will face Sudan, who shocked high flying Zambia 1-0 on Saturday, for a place in the final next Sunday.
The Nigerians had to come from a goal down after Vladimir Antonio opened the scoring for Angola in the 56th minute. Anthony Okpotu rescued the game for the Nigerians when he scored the equaliser in the final moments of regular time (90th+1).
Gabriel Okenchukwu then scored the Nigerian winner in the 109th minute after a brilliant individual run facilitated by sloppy defending from Angola.
Morocco 2 Namibia 0
Zambia 0 Sudan 1
Nigeria 2 Angola 1
Congo 3 (1) Libya 5(3)
Morocco Vs Libya (Casablanca)
Nigeria Vs Sudan (Marrakech)