Amar'e Stoudemire added 23 points, J.R. Smith 22 and Carmelo Anthony 20 as the Knicks won their fourth game in a row.
Michael Carter-Williams recorded a triple-double with 23 points, 13 rebounds and 10 assists, while Tony Wroten also had 23 points for the struggling 76ers.
The Knicks, who trailed by 12 points in the first quarter, took their biggest lead of the game, 110-89, on the fourth of Hardaway Jr's five 3-pointers with 7:37 left and never led by less than 12 the rest of the way.
Philadelphia took its biggest lead of the game at 29-17 on James Anderson's 3-pointer with 2:45 left in the first quarter before the Knicks cut it to 31-26 at the break.
Smith scored 12 of his points in the opening quarter.
The 76ers built their lead back up to nine at 42-33, but the Knicks scored the next seven points to pull within two. New York then took its first lead since the opening minutes on a three-point play by Stoudemire with 4:31 left in the half.
The Knicks stretched their lead to five points on four occasions, but Henry Sims' dunk with 2 seconds left tied the game at 61 at halftime.
Then, with the 76ers ahead 67-66 following two free throws by Jarvis Varnado with 10:22 left in the third quarter. The Knicks scored the next eight points to take a 74-67 lead.
The lead was short-lived, however, as Philadelphia countered with its own 8-0 run to reclaim a one-point lead.
After Thaddeus Young's short jumper gave Philadelphia a 79-78 lead, the Knicks went on a 9-0 run with Anthony scoring the final five points to give the Knicks the lead for good.
New York held a 91-85 lead after three quarters and never looked back.
Raymond Felton added 13 points for the Knicks. Young finished with 18, and Anderson had 17 for the 76ers.
NOTES: Tyson Chandler was not with the Knicks due to "personal reasons." . The 76ers' losing streak is their longest since dropping 20 straight during the 1972-73 season. . The Knicks have purchased a NBA D-League team which will play its home games in White Plains, N.Y., beginning next season. The team's nickname has not yet been decided. . Shannon Brown and Earl Clark were both signed to second 10-day contracts by the Knicks on Monday.