SANA, Yemen — After five months of war in which more than 4,000 people have been killed, Yemen’s government, exiled in Saudi Arabia, faces a fateful decision: leverage recent battlefield gains to negotiate a cease-fire with a weakened Houthi rebel movement, or try to rout the rebels once and for all.

Backed by air support and ground troops from Persian Gulf nations, fighters allied with the government have made significant progress in recent weeks, after Saudi Arabia and the United Arab Emirates poured men and matériel into the strategic southern port city of Aden. The Houthis were driven from the city in July and since then have suffered a string of defeats in southern and central Yemen.

Yemen’s ambassador to the United Nations struck a bullish note last week, predicting that the government and allied forces would be ready to take back Sana, the capital, within weeks.

“It seems they are on the run,” the ambassador, Khaled Alyemany, said of the Houthi militias after a meeting with members of the United Nations Security Council on Wednesday. “My feeling is it’s going to be weeks before we can liberate the entire country from the coup,” he said, referring to the government’s forced resignation at the hands of the rebels in February.

Diplomats and analysts of the region warn against such optimism. They point out that any military effort to rout battle-hardened Houthi fighters from their strongholds in the north would risk a protracted blood bath, aggravate the regional rivalry between Sunni states and Shiite-dominated Iran, and compound one of the world’s worst humanitarian crises.

Intense diplomatic efforts have been underway to persuade the Houthis to withdraw their fighters from cities and to encourage the government and its Saudi backers to halt the airstrikes, according to people with knowledge of the talks.

The Houthis are said to have agreed to concessions, but the insistence by factions in the government that the war should continue has alarmed diplomats who fear that the entrance of Persian Gulf troops into the conflict could prompt Iran to intervene militarily on behalf of the Houthis, their allies.