This happened to a flight I was on about a year ago (UA49 from IAD to LAX on 7/22/07).
About 3 hours into the flight the pilot announced that the landing gear did not fully retract on take off, that we had been burning an extra 1000lbs of fuel per hour, that we didn't have enough fuel to make it to LAX, and that we were diverting to Denver.
Everyone was nervous that the landing gear wouldn't deploy properly...but everything worked fine. After about an hour in Denver, UA found a spare 757 and we flew to LA arriving about 2.5 hours late.