Seemingly unstable basic PIC18F2550 circuit
Two things:

One Vss pin is not connected.  All Vss, Vdd, AVss, and AVdd pins, when present, must be properly connected.

PGM is floating, which is bad if LVP is enabled.  That can randomly put the part in programming mode.