The Blended star said as he took to the stage with his guitar: "I've been trying to write this song for you since the last ... well forever.
"I swear to you I'm a little emotional but I'll try to not get too [chocked up]."
With only his acoustic guitar for accompaniment, the star kicked off the song: "There simply is no better man than good old David Letterman / And no one gets Julia Roberts' face redder than a flirty David Letterman / He's leaving after 30 years, and you know he will be missed / If you like gap-toothed men in double-breasted suits, he's number one on your top ten list."
Sandler gave Letterman some ideas as to what he can do now he is retired.
"He'll finally have time to take Jay Leno out for coffee and secretly pee in a cup."
The comedian also made jokes about what late night will be without the silver haired star.
"Pets with stupid tricks will have no place to go while Paul Shaffer and the boys sell crack on the streets," the actor crooned.
Getting in a rather sexual joke about this own mother, Adam finished on a sentimental note.
"There is simply is no better man than our hero David Letterman / I can't thank you enough for all you have done / And I'm sure I ain't the only one / As you paved the way for every late night show...
"You're the king of comedy and my best friend on TV."
Getting up from his chair, Letterman thanked his friend - who was tearing up - with a big hug saying, "Oh my that was beautiful".
David Letterman's last show is May 30, ending a 22-year-run on the show and three decades on late night.
- Daily Mail