The Kings also received guard Scotty Hopson and a trade exception from Houston in the deal announced Wednesday.
The 37-year-old Terry started last season with Brooklyn and averaged only 4.5 points in 35 games. He was moved to Sacramento at the trade deadline and didn't play the rest of the season as he recovered from a left knee injury.
Terry played in Boston in 2012-13 after eight seasons in Dallas, where he was named the league's Sixth Man of the Year in 2009 and 2011. Gee and Hopson came to Houston as part of a three-team trade in July that also brought Trevor Ariza to the Rockets.
Information from The Associated Press was used in this report.