Harden scored 36 points in his return from a one-game absence, and the Rockets overcame Anthony's 45 points for a 109-106 victory Thursday night.
Anthony had the highest-scoring game in the NBA this season and grabbed 10 rebounds, but it wasn't enough for the Knicks in their fourth straight home loss.
Chandler Parsons added 22 points and Lin had 21 for the Rockets, who beat the Knicks for the eighth straight time even on a mostly silent night from Dwight Howard, largely outplayed by Andrea Bargnani.
"Jeremy stepped up, James played big and that's what we need," Howard said.
Howard had just seven points with his 15 rebounds, though he did make a pair of free throws with 1:15 left that gave Houston a five-point lead.
Harden, who missed the Rockets' 123-117 overtime loss in Philadelphia on Wednesday with a bruised left foot, scored seven straight Houston points for nine-point lead with 3:51 left. He finished 16 of 18 at the line.
But there was plenty of excitement left, including Anthony just missing a potential four-point play when the Rockets fouled him intentionally behind the arc leading by three with 5 seconds left.
Anthony threw the ball up and it went in, but officials ruled it came after Harden fouled him. The Rockets hadn't fouled in similar situations lately, and both Toronto and Philadelphia made late 3s to force them into overtime.
"It seems like that has happened a lot to us lately. Last-second shots. The first two times you know we didn't foul and they made big 3s. Tonight a foul and they still made a big 3," Harden said.
Knicks coach Mike Woodson wanted referees to review the call, though it isn't reviewable, and Anthony wouldn't say if he believed it should have counted.
"My thoughts don't mean anything at this point in time," said Anthony, who did express his frustration with some of the calls Harden received. "It really doesn't matter right now for me to say whether I thought it was a good call or not. So therefore we move on from that."
Anthony made both free throws -- he was trying to miss the second intentionally -- but Harden answered with a pair to make it 109-106 with 2.9 seconds to play, and J.R. Smith was well off with a long-distance heave at the buzzer.
Bargnani scored 24 points for the Knicks and played surprisingly strong defense on Howard, who shot 1 of 5. Smith scored 15 points in his second start but shot just 4 of 16 for the Knicks, who also cost themselves when Anthony's intentional foul on Howard away from the ball came with under 2 minutes left, allowing the Rockets to retain possession.
Lin, back to coming off the bench after starting Wednesday in Harden's place, has won both games back at MSG, where he burst onto the worldwide scene two years ago during his memorable run of Linsanity.
Lin came in on another nice roll, scoring 65 points in his previous two games, the best two-game stretch of his career. But the Rockets wasted his 34-point, 12-assist game Wednesday that featured a Rockets record-tying nine 3-pointers.
"We played more as a team today," Lin said. "We really moved the ball, shared the ball. We played really unselfish today and we also did what we needed to do defensively."
Houston led 28-23 after one and was starting to run away with it when it opened a 49-35 lead during Parsons' run of 11 straight Rockets points. But he didn't score the rest of the half after his driving dunk with 3:10 left, and Anthony and Bargnani combined for three 3-pointers during a 13-2 run to close the half and cut it to 53-52.
"We've let four games in a row at home get away, that's something we hadn't done since I've been here," Woodson said. "That's kind of frustrating from a coach's standpoint, but we're still learning each other and trying to figure it out, and we will eventually."
Center Omer Asik didn't play for the Rockets after the Houston Chronicle reported he had requested a trade. He had been starting along with Howard until coach Kevin McHale scrapped the alignment. McHale said Asik told him he didn't feel well and that he hadn't heard about any rumors. ... Rockets backup forward Greg Smith left with what appeared to be a right leg injury following an awkward landing after playing just 40 seconds in the first quarter.
The Derrick Rose trade puts much of the Knicks' roster into play. Here is a look at how the move will impact the team on and off the court.
The Chicago Bulls agreed to the best offer on the table to separate from Derrick Rose and took the first step in a long rebuilding process.
Paul George, who had wavered on whether he would try to play for Team USA at the Rio Olympics, has accepted an invite to play for the team, a source said.