Why is the base of the photo-transistor grounded?
The 1K gate resistor looks too low to me. The 330Ω in series with the photo-emitter will limit the current to (5-0.5-1.5)/330 = 9mA. The Current Transfer Ratio for the 4N25 can be as low as 10%, meaning that the current through the gate resistor would be about 1mA, which would only make 1V at the gate; hardly enough to turn on the NFET.
The PIC pin can source ~20mA, so cut the 330Ω to 150Ω. Raise the gate resistor from 1K to 3.3K.
Even at that, it is still a crummy gate driver.
A proper gate driver for this FET should source/sink ~250mA in order to switch it on/off fast. Even with the changes suggested above, your are driving the gate with ~few mA. It might work if the PWM rate is slow enough (100Hz)