look bellow picture
u can see upper diode and resistor used to charge battery when 5v power supply present at same time PIC will work normal mode bcz ~3v present in RB0 pin, if suppoly become 0v then RB0 !=0v so pic can,t goto sleep mode , when i give RB0=0v from externaly(directly to gnd removing from previous connection) then its work fine. program is when RB0=0 then goto sleep else work in normal mode.Can u find wats the hardware fault/ is there any other simple good ckt instead of this?