The court found Merhi and Oneissi distributed a video in which a fictitious group claimed responsibility for the attack, in a bid to protect the "real perpetrators" from a covert network in the Lebanese Shiite militia Hezbollah.
But the pair are unlikely to ever spend time behind bars as Hezbollah has refused to hand them over, as it has refused to surrender a third man, Salim Ayyash, who was sentenced to life imprisonment in 2020.
Presiding judge Ivana Hrdlickova said both Merhi and Oneissi were aware that Hariri would be killed in the attack, adding that the sentences reflected the "evil nature of terrorism".
"The appeals chamber therefore unanimously decides to sentence Mr Merhi and Mr Oneissi to life imprisonment, the heaviest sentence under the statute and the rules for each of the five counts on which they were convicted," she said.
The men were found guilty of conspiracy to commit a terrorist act, and of being accomplices to commit a terrorist act, accomplices in the intentional homicide of Hariri and of the 21 other people, and accomplices in the attempted homicide of the 226 injured.
The attack on Sunni billionaire Hariri, who had stepped down as Lebanon's prime minister in October 2004, triggered protests that drove Syria out of Lebanon after a 29-year military deployment.
The court was born in 2009 out of a United Nations Security Council resolution and eventually tried four suspects in absentia: Ayyash, Merhi, Oneissi and Assad Sabra.
The case relied almost exclusively on circumstantial evidence in the form of mobile phone records that prosecutors said showed a Hezbollah cell plotting the attack.
The STL originally convicted Ayyash and cleared the other three men.
It said there was no direct evidence of Damascus or its ally Hezbollah's involvement, but that the attack probably involved state actors and that the state with most to gain was Syria.
But in March it found Merhi and Oneissi guilty after an appeal by prosecutors, saying the original trial judges had "erred" by saying there was a lack of evidence. They upheld the acquittal of Sabra.
All three convicted men remain at large as Hezbollah leader Hassan Nasrallah has refused to hand over any of the suspects or to recognise the court.
The sentencing could be one of the last acts by the STL as the cash-strapped court has warned it will close imminently due to a shortage of funds.
The court is estimated to have cost between $600 million and $1 billion since it opened and has been dogged by political issues in Lebanon and controversies over its price tag.
The closure means a further trial against Ayyash in a separate case involving three attacks targeting Lebanese politicians in 2004 and 2005 is now unlikely to ever take place.
The STL draws 51 percent of its budget from donor countries and the rest from Lebanon, which is grappling with its deepest economic crisis since the 1975-1990 civil war.