First you have to determine wheither your problem is in software or hardware. Are you driving the 5v relay direct, if so the relay coil may pull more current than the PIC can supply. PIC output current is normally 20mA. A schematic and program would help solve the problem