In my project i need to interface a gps receiver and a gsm modem to pic16f877a, But there is only one set of UART lines in this Microcontroller. Is it possible to multiplex these two devices using software without the use of additional hardware?
You're approaching the problem in the wrong way. You have two devices that put out serial data, so you need a microcontroller with two UARTS. Luckily, such things are available, for example among the PIC24's there are chips that have two UART ports and two I2C ports. These are still PIC, so you can apply your PIC16 skills.
Match the microcontroller to the application! Do not have a "pet" microcontroller that you use for everything, no matter what.
There isn't much reason to use a PIC16 today in a new design. It's great that Microchip stands behind them and still makes them. But the primary value of this is that you can replace a nonworking one in an old device.
As was stated in the other answers consider switching to a more advanced PIC with 2 UART modules. The PIC18 series of microcontroller is still 8-bit, but offers more peripherals than the PIC16's. Switching to a PIC18 would also allow you to take advantage of the Microchip C18 compiler which makes writing the programs easier (can be written in C instead of Assembly) and the compiler comes with a set of software libraries, for example a software implementation of a UART peripheral.