Lately my z5 has been turning off when the battery hits 40%, sometimes 20%. Doesn't always happen, but when it does it flashes battery is 0 and shuts down. It won't turn back on, showing battery flat, but if I connect the charger it then shows real percentage and will turn back on. The phone is over 2 years old so wondering if the battery needs replacing? I've tried full reset through the companion app so not phone software issue.
As you have already performed a software repair using Xperia Companion, I would recommend that you get in touch with your Local support team so they can arrange for your device to be sent to an authorized service centre so a trained technician can examine it.
If you have any questions regarding warranty, local service routines and so on, they will gladly assist you with this as well and will be able to provide much more accurate information than I can since this varies between markets.