A month after the resolution cleared the key hurdle of the Senate, which is controlled by Trump's Republican Party, the Democratic-led House of Representatives voted 227-186 to approve the measure that bars any military action against Iran without an explicit vote from Congress.
But the resolution is virtually certain to be vetoed by Trump, and the coalition of most Democrats and a handful of war-skeptic Republicans lacks the votes to override him.
"If President Trump is serious about his promise to stop endless wars, he will sign this resolution into law," said Senator Tim Kaine, the Democrat who spearheaded the move.
The House voted moments after a rocket fired on a military base north of Baghdad killed an American soldier, a British soldier and a US contractor, in the deadliest such attack on foreign forces in Iraq in several years.
A similar attack in December that killed a US contractor set off a chain of escalation after the United States blamed it on Iranian-aligned Iraqi Shiite militias.
On January 3, Trump ordered a drone strike that killed Iran's most powerful general, Qassem Soleimani, at the Baghdad airport.
Supporters of the resolution said they wanted to ensure that Congress has the unique power to declare war, as outlined in the US Constitution.
"There are a lot of countries in the world where one person makes the decision. They're called dictators," said Representative Steny Hoyer, the second highest-ranking Democrat in the House.
"Our Founding Fathers did not want dictators running America," he said.
Republicans praise Soleimani killing
Representative Mike McCaul, the top Republican on the House Foreign Affairs Committee, denounced the resolution and said that it should instead state that Trump's killing of Soleimani made Americans safer.
"The enemies of our country are watching this debate right now. They need to know darn well that if you kill Americans, you will pay the price," McCaul said in a floor speech met with loud cheers from Republicans.
Six Republicans and six Democrats crossed party lines in the House. In the Senate, eight Republicans had bucked their leadership, with one complaining that a briefing by the Trump administration on Iran had been the worst he had ever heard on any military issue.
The resolution, if it becomes law, would not stop Trump or future US presidents from taking military action if they determine there is an imminent threat from Iran.
The Soleimani strike angered Iraqi leaders, who called for the ouster of US forces. Some questioned whether Shiite militias carried out the attack in a country that still is trying to eliminate Islamic State fighters.
Trump, who has vowed to pull troops around the world and recently sealed a deal with Afghanistan's Taliban insurgents, responded furiously to Iraqi threats to boot out US forces, threatening to impose sanctions.
About 5,200 US forces are stationed in Iraq as part of an international coalition formed in 2014 to confront the Islamic State group. The jihadists captured vast swathes of territory after the earlier departure of US forces, who toppled dictator Saddam Hussein in a 2003 invasion that turned disastrous.