It'll only be one of three things in my guess...
1. Your MCLR pin has NOT been configured as INPUT properly. Your appended code doesn't show anything in that department. so, we assume you are setting it manually (and correctly) in your programming software. As a test, put some blinky LED code in (to show that your code is working) and then ground GROUND the MCLR pin. If it doesn't blink, there's your problem.
2. Your Pin 4 (I/O 4) is shorted. When you toggle it in software you could be connecting it to Vdd or 0v and pulling your Supply rail down.
3. Your supply is crap and connecting the other end of your Pull-Up Resistor (which is way too low a value - or indeed could be dud) to 0v is enough to cause a glitch and Brown-Out the PIC. Try a 10K Resistor here.
Bookmarks