Share your experience!
after inserting the headphones, when I remove them, phone remain locked in the headphones mode and must be restarted each time to return to the speaker
Hi @Machociprian, sorry to hear about this. 
Is this something you have started to experience lately, for example after updating your device or installing a new application?
I recommend that you start with resetting the application called Smart Connect in your phone. To do that, go to Settings > Apps > three dots in the top right corner > Show system > Smart Connect > Storage > Clear data.
Once the data has been cleared, restart your phone > connect the headphones and remove them again and see if you are able to play, for example a YouTube video and the sound is coming through the speaker.
If there is no change, try rebooting your phone in safe mode, so we can see if any of your downloaded applications is the cause of this.
Should you however experience the same behaviour in safe mode, try performing a software repair using Xperia Companion.
This will delete all data stored on the internal storage of your phone, so creating a backup using Xperia Companion before you start with the repair is advised.
Let me know how it goes!
No....i try all this solutions and the same problems.....
Hi again!
In this case your device will need to be examined at an authorized service centre and your Local support team will assist you further and answer any questions you may have regarding local service routines, warranty and so forth!
Feel free to keep me posted!