Thailand’s complicated system of apportioning seats from votes means that Pheu Thai could still win around the same number of seats in the 500-seat lower house as Palang Pracharat, but with the Senate firmly in the military’s hand, its power as an opposition party will be diminished.

Uttama Savanayana, the leader of Palang Pracharat, said in a news conference that Mr. Prayuth had already called to commend him on the party’s performance.

The official election results will be released by early May. With the unexpectedly strong performance by the military, it appears that the tense status quo will continue in Thailand, with the military-backed government in control and voters seeking change frustrated.

On social media on Sunday night, the hashtag #prayforthailand was trending high.

Ever since Mr. Thaksin, a former telecommunications billionaire from northern Thailand, swept to power in 2001, buoyed by support from the country’s rice-growing heartland, the nation has been split between an establishment elite and a populist groundswell. By some accounts, Thailand is the most unequal society on earth, and its wealth gap has only widened during five years of junta rule.

“Pheu Thai Party is always on the people’s side,” said Nongnuch Waree, who voted for the Thaksin-associated party on Sunday. “Their policies touch the people of all classes, especially the lower class.”

In election after election, the largest bloc of voters has chosen parties aligned with Mr. Thaksin, appreciative of his parties’ health care and rice subsidies. Just as predictably, the military has launched coups, one against him and one against the government of his sister, Yingluck Shinawatra. Security forces crushed protests by loyalists to Mr. Thaksin, killing dozens.