Chairboys boss Gary Waddock told the club's website: "I'm delighted to bring Stuart to the club and he will provide valuable competition in the midfield.
"Matt Bloomfield and Lewis Montrose are one yellow card away from suspension and Stuart gives us another option."
Lewis made 60 appearances during his two years at the Gills, scoring once.
He left Tottenham in 2007 after failing to make the step up from their youth system and has also featured for Barnet and Stevenage.
Source: BBC Sport
Source: BBC Sport