Treat You Better Shawn Mendes Download 'Treat You Better' on iTunes
They were due to headline Glastonbury on 25 June. The 50 year old singer said he was "heartbroken".
Organiser Michael Eavis promised Damon Albarn's virtual pop band would provide "a massive audio visual spectacle which will really ignite the Pyramid Stage".
In their only full UK festival appearance, Gorillaz will top the bill on 25 June. Albarn also headlined the event last year with Blur.
Mr Eavis added: "I'm very excited about Gorillaz' show coming here because they're so open to guests and collaborations.
The announcement comes a day after the Irish band were forced to pull out following Bono's back surgery.
Bono must recuperate for the next two months. The band's manager Paul McGuinness said the group were "devastated" at postponing the concerts.
Glastonbury had been attempting to book U2 for many years and it's claimed the band had written a new song for the 40th anniversary Festival.
There's been no announcement yet on a possible replacement. Dizzee Rascal, who is below U2 on the Pyramid Stage bill on Friday 25 June, could now take the headline slot. Festival favourites Coldplay have also been mentioned as possible replacements.