Ousted PM says his party, which holds the parliamentary majority, will not participate in the new government.
Lawmakers reinstate Sonko and elect him speaker with overwhelming support in Senegal's legislative body.
As speaker, Sonko could use his position to challenge the policies of the president, his one-time ally.
The move by speaker El Malick Ndiaye clears the way for sacked premier Ousmane Sonko to run for head of parliament.
The renewed instability could complicate bailout negotiations with the International Monetary Fund.
Supporters of Senegalโs ousted prime minister have rallied outside his home in Dakar.