I am doing the same thing tomorrow (arriving in to LHR and flying onwards from LGW). There are many ways to connect, personally, I find Megabus works well... Pulls up to T5 (so can wait in arrivals lounge, then walk kerbside), and bus off to LGW. Or, take a taxi, train etc..
Pretty easy transfer and 3+ hours is PLENTY of time (normally)