The British royal surprised guests when he joined the country pop star and rocker on stage for a rendition of Bon Jovi's "Livin' On A Prayer."
William wore a tuxedo and clasped his hands in front of his body as he crooned into the microphone. Swift wore a sequined, cream-colored dress and high-fived the prince at the end of their performance. Bon Jovi played his guitar in a black suit and tie.
Swift posted an image of the trio on Instagram with the caption: "OHHHHHH! LIVIN ON A PRAYERRRRR."
The performance was held as part of The Winter Whites Gala in Aid of Centrepoint at Kensington Palace on Tuesday to raise money for the homeless.
Bon Jovi was honored with the Centrepoint Great Britain Youth Inspiration Award for his humanitarian work. Other stars who attended included "Downton Abbey" actress Michelle Dockery, actor Colin Firth, actor Benedict Cumberbatch and singer/songwriter James Blunt.