Saudi-backed government forces in Yemen suffered twin setbacks on Thursday as Iran-linked Houthi rebels gained ground in Aden and lost another port city to al Qaeda militants, who freed one of their leaders and other inmates from prison.

By evening, the rebels had taken most of Aden, Yemen’s second-largest city, despite a weeklong Saudi military offensive against them. They held the city center as well as a strategic hilltop military base and cluster of villas overlooking the port—the last stronghold of Yemen’s president before he fled the country on March 25.

The government losses pointed to deepening turmoil in a country that is central to U.S. counterterrorism operations in the region. A Saudi-led coalition, which includes the Sunni monarchies of the Gulf and is backed by the U.S., has declared an open-ended operation to defeat the Houthi rebels and restore President Abed Rabbo Mansour Hadi to power.

The U.S. deepened its role in the conflict on Thursday by agreeing to allow American military planes to start refueling Saudi jets bombing Houthi fighters. American surveillance planes over Yemen are already providing the Saudi-led coalition with intelligence to help carry out airstrikes and try to minimize civilian casualties, U.S. officials said.

The United Nations said more than 500 people have been killed, among them civilians, and 1,700 injured in the past two weeks amid the Saudi airstrikes and fighting between the Houthis and government forces loyal to Mr. Hadi.

Al Qaeda’s predawn storming of al Mukalla, a port city east of Aden, was the latest sign that the extremist group is using the sectarian strife to expand its foothold in the country.

Abdullah al Sharafi, a Yemeni Defense Ministry official, said about one-third of those freed in Thursday’s prison break were militants of al Qaeda in the Arabian Peninsula, or AQAP. Among them, he said, was Khaled Batarfi, AQAP’s emir in the southern province of Abyan until his arrest in 2011 and served in the group’s Shariah council, which provides religious direction.

Extremist groups such as AQAP and Afghanistan’s Taliban have typically used prison breaks to free their own foot soldiers and force more secular inmates, detained for petty crimes, to join their ranks. “Al Qaeda needs to recruit and [there’s] no better way to recruit from prison,” Mr. Sharafi said. “A few of the escapees were senior al Qaeda leaders, but among those who escaped were dozens of al Qaeda fighters and loyalists.”

AQAP also overran key government offices, including a branch of Yemen’s central bank, plundering its cash reserves in the poor country before burning down the building, officials said. At least a dozen government soldiers were reported killed as fighting continued into the night.

Yemen’s chaos has split the armed forces, with some units backing the Houthi uprising—distracting attention from the fight against AQAP, “The military is divided and fighting one another instead of fighting al Qaeda,” Mr. Sharafi said.

The Houthis’ monthslong advance from its northern strongholds into southern Yemen prompted the U.S. last month to withdraw its special counterterrorism forces from al Anad air base, where they trained their Yemeni counterparts and launched drone strikes against AQAP targets throughout Yemen.

U.S. officials said that one unexpected result of the fighting in Yemen has been to disrupt AQAP’s efforts to plan attacks on U.S. targets around the world.

“The initial evidence is actually that the Houthi advance has caused [AQAP’s] external plotting to be sidelined while they figure out how they’re going to deal with the internal vestiges of what appears to be an emerging civil war,” an American official said. “Although our capability is diminished, I wouldn’t suggest it puts us at greater risk right now.”

Saudi Brig. Gen. Ahmed bin Hasan Asiri, a spokesman for the Saudi-led coalition, saw another result of the fighting. The Houthis have “weakened the Yemeni state” and kept it from fighting terrorist groups, he said. “Militant groups like al Qaeda prefer to operate in what we call ungoverned space.”

Until Thursday, al Makalla had been one of the few large Yemeni cities still controlled by government and tribal forces supportive of Mr. Hadi.

The Saudi-led coalition, aided by U.S. intelligence and logistical support, has cut off Yemen by air and blocked its ports. On Wednesday, Saudi naval vessels began bombarding Houthi positions in Yemen’s seaports. Saudi officials say the Houthis, who last year took over San’a, the capital, are acting as a proxy for Iran. The Houthis say they are allied with Iran but are acting on their own.

Saudia Arabia on Thursday reported its first casualties since the start of the operation, saying Houthi fire from inside in Yemen had killed a Saudi border guard and wounded 10 others in the kingdom’s Asir region. The Houthis said their forces had opened fire at Saudi forces trying to breach the Yemeni border.

The rebels have been fighting for control of Aden since last month. They had taken the hilltop presidential compound and much of the city last week before Saudi airstrikes drove them back.

“The Houthis don’t care much about ruling Aden but they want to ensure it does not become a hub for foreign deployment and interference,” said Ali al Qubaisi, a government security official in Aden.

Mr. Qubaisi said the Houthi fighters had split into small groups, spread through the city and blended with the civilian population, making it hard for Saudis to target them with airstrikes. The bombing has already hit factories, a refugee camp, medical facilities and civilian vehicles, international aid workers say. The United Nations on Wednesday put the death toll at 93 dead and 364 wounded since the Saudi-led campaign began last week.

Gen. Asiri, the Saudi spokesman, denied again Thursday that coalition airstrikes were hitting civilians.

Gulf states are urging the U.N. Security Council to impose an arms embargo on the Houthis. Jordan’s ambassador, Dina Kawar, the council president for April, said Thursday that negotiations on a proposed resolution were stalled. Two Security Council diplomats said Russia was demanding that any embargo be extended to all parties, including forces loyal to the ousted president.

Russia’s U.N. mission didn’t respond to a request for comment.

—Dion Nissenbaum in Washington, Ahmed Al Omran in Riyadh, Saudi Arabia, and Joe Lauria in New York

contributed to this article.