How can I lock, and erase all my Windows Phone 8 device, if it was stolen or forgotten somewhere?
There is a feature called Find My Phone which you can use it.
To enable locking and erasing the phone data remotely, you will need to have the following settings enabled. To check, go to Settings > Find My Phone and check the following
Always use push notifications(not SMS) to send commands and apps to my phone
Save my phone's location periodically and before the battery runs out to make it easier to find
To lock your phone:
On your computer, go to windowsphone.com.
Point to the phone in the top-right corner, then click Find My Phone. If you're prompted, sign in with the same Microsoft account you used to sign in on your phone.
To lock your phone and show a message on the lock screen, click Lock, then follow the instructions. If you don't already have a password set up on your phone, you'll need to enter one – you'll use it to unlock the phone if you get it back.
To Erase phone data
On your computer, go to windowsphone.com.
Point to the phone in the top-right corner, then click Find My Phone. If you're prompted, sign in with the same Microsoft account you used to sign in on your phone.
Click Erase.
If you're absolutely, positively sure, tick the I'm sure! Please erase my phone now checkbox, then click Erase.