MOSFET Heating in LED Driver Circuit
There is no way for your MOSFET to turn off.



Figure 1. Move R39.

The problem is that when the opto turns on Q1's gate capacitance is charged up. When the opto turns off there is no discharge path. If the gate voltage gradually leaks away Q1 will gradually turn off resulting in substantial current through it while there is substantial voltage across it so the power will increase drastically.

By moving R39 to the position shown the 'on' condition won't change but there is a discharge path for the gate. Turn off should be very fast.