After a July 1981 coup d'état in The Gambia, a small country surrounded by Senegal, Diouf sent Senegalese troops in to restore The Gambia's civilian president Sir Dawda Jawara. For closer protection the two countries formed a loose confederation called Senegambia between 1982 and 1989. However, after the 1994 coup in which Yahya Jammeh toppled Jawara, Diouf refused to intervene again, and Jammeh remained in power.

Senegal has been one of the few democracies in Africa, though the ruling party always retained power. Diouf was re-elected in 1983, 1988, and 1993. But finally Diouf and his Socialist Party lost the presidential election in March 2000 to opposition candidate Abdoulaye Wade of the Senegalese Democratic Party, who took office on 1 April.