Well before starting the process you may like to learn a few things and not forget to backup your Xperia Smartphone. although this process is simple and risk free , we recommend a complete nandroid backup.
Also backup your SD card as well.
Never be in a hurry , recheck before you proceed to next steps. some times your phone may go in soft brick or bootloop so better be prepared for the worst in case it happens.
What all you need before rooting Xperia ray :
Sony Ericsson Xperia Ray
Latest Version of Flash Tool
Xperia Ray Kernel ( 4.1.A.0.562 )
Xperia Ray Kernel ( either 4.1.B.0.587 or 4.1.B.0.431 ) depending on your present version.
Steps to follow to root Xperia Ray :
Step 1 : Ensure the following settings twice :
Settings > Security > Mark "Unknown sources"
Settings > Developer options > Mark USB debugging
Settings > Xperia > connectivity > USB connection mode > select MSC mode
Step 2 : Install the latest version of FlashTool from above download link and Copy the required kernels
C:/ Drive > flashtool > firmwares
Step 3 : Run Flashtool & Click on the flashing icon ( left side below "file" option)
Select flashmode > ok
Select the Kernel 4.1.A.0.562 and Click OK
And follow the remaining steps i,e: Connect the device while holding the lower volume button.
( Ignore all errors if you have followed the above procedure correctly )
When flashing is done , you can disconnect the device and restart it.
Step 4 : Now Root Xperia Ray Using The following Method
Step 5 : After Complete the Step 4 , switch off the mobile and again flash Kernel either 4.1.B.0.587 or 4.1.B.0.431 respectively ( donot flash both , just flash your version ) the steps are same as Step 3.
Now restart your Xperia Ray and enjoy rooting.
Note : Rooting your mobile may void your warranty and you are doing it at your own risk. We would be in no way responsible for any damage.