You need to do a factory reset via Menu -> Settings -> Privacy -> Factory Data Reset
(this may be under a different menu on newer versions of Android.) You Factory reset formats your device, erasing all 3rd-party installed apps and their settings. It also dis-associates your accounts (Google, or any others you may have added) from the device, removing any synced contacts.
You may also wish to format your SD Card if you are giving it along with the phone.
Apps, books, music and videos that you purchased via Google Play Store are tied to your Google account. You will be able to re-download them to your new Android device after signing in with your Google account.