First is to give them notice, thank your hosts for their hospitality, and express your appreciation for their kindness.  Offer to help clean up before you leave, and tell them you had a great time. Find out how you can tell someone they can't stay at your house here.