“There are no more red lines left for terrorists to cross. Sunnis, Shiites will both remain victims unless we stand united as one,” Foreign Minister Mohammad Javad Zarif said on Twitter.
Four security guards were killed in the Madina bombing. The other attacks on Monday targeted the US consulate in the Red Sea city of Jeddah and the Shiite minority in the east of the Sunni-dominated kingdom.
“Terrorism knows no border or nationality and there is no solution except creating an international and regional unity against this phenomenon,” foreign ministry spokesman Bahram Ghasemi told state broadcaster IRIB.
There were no immediate claims of responsibility.
The Prophet’s Mosque marks the place where Mohammed (PBUH) is buried and attracts millions of pilgrims each year.
Iran and Saudi Arabia are locked in an increasingly tense competition for regional influence, and back opposing sides in regional conflicts, including in Syria and Yemen.
Riyadh broke off diplomatic relations with Tehran in January after protesters attacked its embassy in the Iranian capital and its consulate in second city Mashhad.