DUBAI—Saudi Arabia’s closest allies have sided with Riyadh in its diplomatic standoff with Iran, but the kingdom’s attempts to assemble a broader anti-Tehran bloc are exposing the limits of its influence in the Muslim world.

Bahrain, a tiny island country connected to Saudi Arabia by a causeway, and Sudan, which has sought Saudi financial patronage, quickly cut all ties with Shiite Iran after the kingdom made the move in response to attacks on its diplomatic facilities in the Islamic Republic.

But, despite a recent flurry of Saudi diplomatic contacts, many other allies resisted.

The difficulties underscore a wider challenge the new Saudi King Salman, and his Deputy Crown Prince and son, Mohammed Bin Salman, face as the monarchy tries to assert itself as a leader among Sunni-majority countries.

The push comes as Riyadh and its Gulf allies fear that the lifting of economic sanctions on Iran will allow it more room to meddle in Arab affairs. They are also concerned that a thaw in Iran-U.S. relations as a result of last year’s nuclear deal means Washington is abandoning long-standing ties with the Gulf states, forcing them to be self-reliant against an empowered Iran.