DOHA, Qatar—Oil producers that supply almost half the world’s crude failed Sunday to negotiate a production freeze intended to strengthen prices.

The talks collapsed after Saudi Arabia surprised the group by reasserting a demand that Iran also agree to cap its oil production.

Oil prices had rallied in recent weeks on speculation that Saudi...