The 'Everything Has Changed' hitmaker said he had a great time entertaining the guest, especially when the comedian joined him on stage, reported Contactmusic.
"Courteney set up like a PA system and I did a show there.
It was very random. One of my all time favourite actors and comedians, Sacha Baron Cohen, was there and we ended up jamming and he did a rap in Arabic and stuff. It was very funny," Sheeran said.
He also spent time with Cox's 'Friends' co-star Jennifer Aniston and gorged on tasty treats.
"Then I turned up... And they're having a proper Thanksgiving meal and I'm there and I think I was wearing my board shorts or something. It was fun.