We had a 4 hour LGW-LHR transfer and barely made it. We'd booked tickets on National Express Coaches which is easy enough and traffic wasn't bad in the middle of the day, but LGW immigration for non UK/EU residents is an absolute nightmare. In the end we made it but it was way too stressful to ever do it again.