Tanvir, 30, has made 170 domestic and 42 international Twenty20 appearances and has previously played in England with Hampshire.
His figures of six for 14 for Rajasthan Royals during the 2008 Indian Premier League stood as a bowling record in the game's shortest form until Somerset's Arul Suppiah took six for five three years later.
"Sohail is a quality top-order bowler and a dangerous lower-order batsman," said Somerset director of cricket Matthew Maynard. "There is no doubt he will be an extremely useful addition to the squad.
"I worked with him at St Lucia Zouks and he was our star performer so I am looking forward to teaming up with him again.