Erase it completely.
Go to Settings > General > Reset > Erase All Content and Settings
Or plug it into iTunes and click Restore, and then when it finishes rebooting do not restore from back up or set up as a new phone.
Just give it to the person you sold it to.