Sony phones have an unlock counter which only allows a certain number of unlock attempts before the phone is unable to be unlocked.
In order to check the remaining number of unlock attempts please follow these steps:
To do this in most devices key #987654321# into the device or as below
1. Turn on the phone without sim card
2. Type *#*#7378423#*#*
3. Select Service info
4. Select SimLock
5. Check where is X
6. If X is on NETWORK and value is different than 0, you can unlock your phone.
7. If it is 0 unlock by code is NOT possible.