The 44-year-old musician was due to perform as frontman for the band at the Playing in the Sand festival in Mexico from January 7 to 10.
The US group features former Grateful Dead members Bob Weir, Mickey Hart and Bill Kreutzmann.
Earlier this week, Kreutzmann also pulled out of the show under advice from his doctor following heart issues.
A statement from the band on Instagram said: “Today, just prior to leaving for Mexico, per his physician, @JohnMayer tested positive for Covid-19 and will be unable to perform at the upcoming Playing in the Sand event in Riviera Cancun January 7-10.
“The weekend will now feature Dos Hermanos con Amigos: @MickeyHart and @BobWeir with @JeffChimentiMusic and @Oteil_Burbridge, joined by @LuvrzLane, Tom Hamilton @trhjunior and including special guests and sit ins including @MissMargoPrice and others.”
Weir said: “We came down here to have fun. Unfortunately some of our brothers cannot make it but fun is what we’re going to have.”
Fans were told they should “expect many rare and different tunes” in such “unprecedented times”.
On January 3, drummer Kreutzmann, 75, announced that he would not be able to perform in Mexico, saying: “It is with a heavy and still recovering heart that I have to relay a note that I received from my doctor this morning, ordering me to sit this one out.
“As many of you know, I had some health issues this past fall. After a lifetime of playing special beats, it’s almost no wonder that my heart came up with its own idea of rhythm.
“All jokes aside, my doctor has ordered me to take it easy (and stay safe) through the end of January so that I can continue to drum and play for you for many tours to come.
“I have a lot of music left in me and there’s no stopping me from playing it.”
American star Mayer is best known for hits including Your Body Is A Wonderland, Slow Dancing In A Burning Room and You’re Gonna Live Forever In Me, as well as his high-profile romances with stars including Taylor Swift, Jennifer Aniston, Jennifer Love Hewitt and Katy Perry.
He has been performing with former members of the Grateful Dead, as well as Jeff Chimenti and Oteil Burbridge as Dead & Company since 2015.