All the hostages were safely released on Saturday night and the gunman was dead, Colleyville Police Chief Michael Miller said at a news conference.
The gunman had initially taken four people hostage, including the rabbi, at the Congregation Beth Israel, officials said. One hostage was released unharmed six hours later.
Local reporters said they heard the sound of explosions, possibly flashbangs, and the sound of gunfire shortly before Texas Governor Greg Abbott announced the crisis was over.
"Prayers answered. All hostages are out alive and safe," Abbott said on Twitter. The FBI said they have confirmed the identity of the gunman but said they would not yet disclose it. The FBI declined to confirm the cause of his death, saying it was still under investigation.
The Colleyville Police Department said it first responded to the synagogue with SWAT teams in response to emergency calls beginning at about 10:41 am during the Shabbat service, which was being broadcast online. FBI negotiators soon opened contact with the man, who said he wanted to speak to a woman held in a federal prison.
No injuries were reported among the hostages.
In the first few hours, the man could be heard having a one-sided conversation in what appeared to be a phone call during a Facebook livestream of the service of the Reform Jewish synagogue in Colleyville, which is about 16 miles (26 km) northeast of Fort Worth. The livestream cut off around 3 pm EST (2000 GMT).
Before the livestream was ended, the man could be heard ranting and talking about religion and his sister, the Fort Worth Star-Telegram reported. The man could be heard repeatedly saying he didn't want to see anyone hurt and that he believed he was going to die, the newspaper said.
President Joe Biden was briefed on the crisis, and Israeli Prime Minister Naftali Bennett said on Twitter he was praying for the safety of the hostages.
Barry Klompus, a member of the congregation since it opened in 1999, said he tuned into the livestream.
"It was horrible listening and watching," Klompus said in a telephone interview.
A US official briefed on the matter told ABC News the hostage-taker had claimed to be the brother of Pakistani neuroscientist Aafia Siddiqui, who is serving an 86-year US prison sentence for her 2010 conviction for shooting at soldiers and FBI agents, and that he is demanding she be freed.
Siddiqui is being held at a federal prison in the Fort Worth area. A lawyer representing Siddiqui, Marwa Elbially, told CNN in a statement the man was not Siddiqui's brother. He implored the man to release the hostages, saying Siddiqui's family condemned his "heinous" actions.
The Council on American-Islamic Relations (CAIR), a US Muslim advocacy group, condemned the man's actions.
"This latest antisemitic attack on Jewish Americans worshipping at a synagogue is an act of pure evil," CAIR said in a statement.
Klompus said he did not know of any significant previous threats to the congregation.
"We don't have a security officer on staff but we have what I would say is a very good relationship with the local police," he said.