The Celtics, with their second straight victory, cut New York's lead in their Eastern Conference quarterfinal series to 3-2. Boston will try to draw even when it hosts Game 6 on Friday.
A seventh and deciding game would be played in New York on Sunday.
New York missed another chance to advance in the playoffs for the first time in 13 years, falling victim to a tenacious defensive effort that slowed down Carmelo Anthony.
Boston hit 11-of-22 from 3-point range and made all 17 of its free throws. The last of Terry's shots from beyond the arc gave the Celtics a 13-point lead with 4:59 to play and Boston survived a late surge that brought the Knicks within five in the final minute.
Kevin Garnett wrapped up the victory by hitting a jumper with 48 seconds to go that boosted the Boston advantage back to seven and he added two free throws with 40 seconds remaining.
Jeff Green led a balanced Boston attack with 18 points including two late 3-pointers that helped hold off the Knicks. Terry and Brandon Bass both had 17 points while Garnett and Pierce contributed 16 each. Garnett added 18 rebounds.
Anthony scored 22 points, but he made only 8-of-23 from the field. Raymond Felton scored 21 for the Knicks.
Notable deaths of 2014 [PHOTOS]
LeBron James reveals his new Nike shoes