Allen is the National Basketball Association's (NBA) all-time leading three-point scorer and a 10-time All-Star who won a championship with Miami's Eastern Conference rivals, the Boston Celtics, in 2008.
"There are only a handful of players that absolutely strike fear into their opponent and Ray is one of those players," said Heat head coach Erik Spoelstra, who declined to get into the specifics of Allen's role on court. "We brought him here to be a big part of what we do."
Allen should bolster a team that was just 10th overall in three-point shooting last season while also helping to open driving lanes for both for James and Wade.
"I'm looking forward to having a high-octane offense with Dwyane and LeBron pushing it and creating so many shots for everybody else," said Allen.
Allen, who will turn 37 later this month, will likely back-up Wade at the shooting guard position but could also play alongside him as an alternative to Mario Chalmers.
Heat president Pat Riley said he had learnt from the failure to build upon the team's title triumph in 2006 and wanted to make sure he added additional elements right away this time.
"That was my mistake. You have got to keep adding pieces to it. We've got to raise the bar and expect more from ourselves," he said.
Forward Lewis, 32, is a 14-year NBA veteran and two-time NBA All Star who played with Allen at the Seattle Supersonics from 2003-07. In their final season together they averaged a combined 48.8 points.
Lewis, also a highly-rated three-point shooter who has a career average of 16.1 points per game, spent last season with the Washington Wizards before being traded to the New Orleans Hornets who bought out his contract, making him a free agent.
After two injury-hampered seasons, Lewis will be hoping to have a shot at a maiden NBA championship and he is also reported to have rejected better financial offers.
Lewis, who has also played for Orlando, is expected to share power forward duties with Udonis Haslem and Shane Battier.
The Heat now have 13 players under contract and have two places remaining on their roster.