Follow these steps.
1. Back up your data and settings to your Google account
2. Back up your photos and videos
3. Back up your Texts and call log
4. Encrypt your data (To encrypt your data, go to Settings > Security > Encrypt phone. )
5. Disable Reactivation Lock (in Settings > Security > and uncheck Reactivation lock.)
6. Perform a factory resetOnce you have all of your data backed up, itís time to wipe it from your device. To ensure all of your data is gone, youíll need to do more than perform a factory reset. In a recent study by Avast, the company found photos and other personal data on factory reset phones.
Source : Click me