Iran, like Haniya's Islamist group Hamas, refuses to recognise Israel.
It is a vocal supporter of the Hamas-led Palestinian government and has handed it $120m in aid since the administration was formed in March.
The Palestinian prime minister said: "They [Western countries] think that the Palestinian nation is alone in this war, but they are hallucinating ... We have a strategic depth here in the Islamic Republic of Iran and throughout the Islamic-Arabic world."
Mahmoud Abbas, the Palestinian president, has sought to put pressure on Hamas to recognise Israel, renounce violence and accept existing interim peace accords.
Ahmad Khatami, a Friday prayer leader in Tehran, reiterated Iran's support for the Hamas government and criticised Western financial sanctions against it.
"We are standing by the Islamic Republic of Iran, and with this country we will resist American and Zionist pressures"
"Those liars, instead of supporting and approving it [Hamas], have taken their swords aloft from the beginning against a government that was appointed by the people's votes," he said.
Haniya said: "We are standing by the Islamic Republic of Iran, and with this country we will resist American and Zionist pressures."
Hamas has sought to bolster ties with its regional allies as it seeks to replenish the Palestinian treasury after Western countries froze aid when the party took office.
Haniya's visit comes after the collapse of talks between Hamas and the secular Fatah faction of president Mahmoud Abbas on forming a government of national unity and ending the aid blockade.