[Sony Xperia M4 Aqua] GuilherMETAL:
Hello there,

I see the thread is a little bit old, but the problem still remains. I'm facing the same issue right now.

About one week ago, my wife's phone (Xperia M4 aqua dual, E2363, with the latest android avaliable) couldn't connect to a wifi network. I told her to restart the phone, which she did. Then the phone couldn't turn on again. It just showed the white screen with Sony logo, then was stuck in bootloop.

First I tried the recovery from Xperia Companion. Followed all the instructions. The software went smooth, but the problem wasn't solved. I did it many times, but the result was always the same. Then I started some research. Since the bootloader was locked (and we'd never cared about turning on usb debugging), I was only able to flash stock roms, and that is what I tried.

So, the next thing I did was to install flashtools. I found a stock rom with older android 5 (the one that is for India Region) and flashed it (it took me a lot of time to find the right rom, install the flashtool drivers, but I got along). At first, the problem wasn't solved, but there were some differences, because the logo screen was now black, but still on bootloop. Then I just left the phone restart itself a few times. It loaded the blueish waves screen and played startup music. After a few seconds, it would crash and restart again. There was some advance, but it still couldn't boot.

Then I realized the phone was getting quite hot. I placed it on a glass table, that helped to cool it down. I turned it face down to cool the screen and kept looking at it through a mirror. After some bootloops, for my surprise, IT BOOTED! It asked me for the google account password and started normally, as if the phone was brand new.

That's when I successfully managed to unlock the bootloader. The phone was restarted many times during the process (in order to plug to computer), and it always booted ok. All this procedure was done without the sim and SD card. So when it started, I connected to my wifi and it worked. I just turned off wifi when I plugged the sim card, so that it could download the internet settings.

I left the phone overnight to charge, so that I could update to marshmellow again. I then reinstalled some apps, like whatsapp and instagram. This morning, while it was setting up whatsapp, I realized the wifi wasn't connected. As soon as I told the phone to connect to my wifi in order to restore message's backup, it froze and started bootlooping again.

I started reading about flashing TWRP, but it needed the phone to be on. So, I left it to cool down before try again. It doesn't turn on at first, but if I leave it trying, it eventually works. I got flashed TWRP on it, but now I'm not sure what can I do with that.

Well, that brings some light to the thread. Considering my experience and all the other replies above, I think that it has something to do with wi-fi and heat on the CPU. I'm still not sure if it's hardware or software failure, though.

I was wondering if a custom mod could solve the issue, or if I just update to marshmellow the problem would stuck it again on bootloop. Can anyone help me with that, please?

Thanks in advance!