A host of stars joined him for the final show, including the singer Bruce Springsteen.
There were also video messages from US Secretary of State John Kerry and Republican Senator John McCain.
Stewart took over the show in 1999 and established himself as one of the most influential satirists in the US and the voice of liberal America.
He is being replaced by the South African comedian Trevor Noah.
The Daily Show, broadcast on Comedy Central, has often been cited as a leading news source for young people, with an average audience of one million viewers.
In his final monologue, Stewart thanked colleagues, fans and family.
"Nothing ends. It's just a continuation. It's a pause in the conversation," he said.
"So rather than saying goodbye or good night, I'm just going to say I'm gonna go get a drink," he said.
The Daily Show has also helped to launch several well-known comic performers, including Steve Carell and John Oliver, as well as Stephen Colbert who is to be David Letterman's replacement on CBS's Late Show.
The hashtag #JonVoyage was trending on Twitter as Stewart bid farewell to the Daily Show, with famous fans paying tribute.
For John McCain, it was a chance for a spot of gentle revenge. Stewart had once mocked him using a puppet resembling the Republican senator.

If you have a picture you would like to share, please see below the images for details on how to submit yours.
If you have a picture you'd like to share, email us at england@bbc.co.uk, post it on Facebook or tweet it to @BBCEngland. You can also find us on Instagram - use #englandsbigpicture to share an image there.
When emailing pictures, please make sure you include the following information:
Please note that whilst we welcome all your pictures, we are more likely to use those which have been taken in the past week.
If you submit a picture, you do so in accordance with the BBC's Terms and Conditions.
In contributing to England's Big Picture you agree to grant us a royalty-free, non-exclusive licence to publish and otherwise use the material in any way that we want, and in any media worldwide.
It's important to note, however, that you still own the copyright to everything you contribute to England's Big Picture, and that if your image is accepted, we will publish your name alongside.
The BBC cannot guarantee that all pictures will be used and we reserve the right to edit your comments.
At no time should you endanger yourself or others, take any unnecessary risks or infringe any laws collecting any kind of media.

The 16-time TT winner, who came off his Tyco BMW at the 27th Milestone, was reported to be conscious before being flown to hospital by helicopter.
Hutchinson, 37, was battling for the lead when the race was red-flagged because of the incident.
He won the Superbike and Superstock races earlier in the week.
He has now been transferred to Liverpool for further treatment. The race was re-started and was won by Michael Dunlop.
The Bingley rider, who suffered a fractured femur, is the third most successful rider in the history of the event.
He endured more than 30 operations on his left leg after an accident in 2010 and after a five-year absence from the top step returned to win eight TTs in the last three years.
Hutchinson is the only man to win five TTs in a week, a feat he achieved seven years ago, and followed that up with trebles at the 2015 and 2016 meetings.
Comedian Jon Stewart has hosted his final broadcast of the satirical US news programme The Daily Show.
[NEXT_CONCEPT]
Each day we feature a photograph sent in from across England - the gallery will grow during the week.
[NEXT_CONCEPT]
Ian Hutchinson has been taken to hospital with a broken leg after crashing on the second lap of Friday's Senior TT on the Isle of Man.