The 10th-seeded Nishikori won 4-6, 7-6 (4), 6-7 (6), 7-5, 6-4 in a match that ended at 2:26 a.m. Tuesday, tying the latest finish in tournament history.
Raonic couldn't get anything going against his serve in the final two sets, unable to force a single break point. And Nishikori earned the two breaks he would need.
"Tried to fight every point, and when I have to play well, I did," he said.
Nishikori pushed Raonic all over the court, finishing off the match with an easy volley after 4 hours, 19 minutes. He will next face Australian Open champ Stan Wawrinka.
"His foot speed was the most probably difficult part," Raonic said. "He was taking the ball very early, controlling the center of the court. He was keeping himself in a lot of situations where someone might be out of position. He was getting himself in good position and giving himself good opportunity to swing at the ball properly."
Raonic couldn't follow up his historic semifinal appearance at Wimbledon with another deep Grand Slam run. He got in just 55 percent of his first serves, and Nishikori took advantage.
"It was tough to concentrate all the time against Milos," Nishikori said in an on-court interview. "He has a great serve, lots of aces."
A severely infected right big toe forced him to miss tuneup events leading up to the US Open, but the layoff didn't seem to hamper his stamina. Nishikori, who got his foot re-wrapped early in the fourth set, looked like the fitter player at the end.
"I was doing a lot of training, but not tennis-wise. I start playing points a couple days ago before the tournament," Nishikori said. "I wasn't expecting big result like this, but after the first round I get more confidence on my foot. It's all good now."
With the crowd at Arthur Ashe Stadium thinning deep into the night, Japanese fans chanted loudly for Nishikori. The 24-year-old had lost to the 23-year-old Raonic in this round at Wimbledon in a matchup of two of the tour's top young players. Raonic went on to become the first Canadian man in the Open era to reach a Grand Slam semifinal.
In the day session, top-seeded Novak Djokovic, playing mostly mistake-free tennis, reached the quarterfinals for the eighth year in a row -- and at a 22nd consecutive Grand Slam tournament overall.
Djokovic, the 2011 champion at Flushing Meadows, made only 19 unforced errors, saved both break points he faced, and breezed past 22nd-seeded Kohlschreiber 6-1, 7-5, 6-4 Monday.
The last time Djokovic was eliminated before the quarterfinals at a major was a third-round loss to Kohlschreiber at the 2009 French Open.
Asked to explain that consistency, Djokovic said, "I love the sport and I play it with a lot of passion." He then did a dance for the crowd at Louis Armstrong Stadium.
Employing his court-covering defensive style to perfection, Djokovic repeatedly forced Kohlschreiber to hit an extra shot, and the German wound up with nearly twice as many unforced errors, 36.
Djokovic improved to 4-0 in head-to-head matchups since that 2009 loss to Kohlschreiber.
Still, Kohlschreiber had a chance to make Monday's match far more intriguing. Ahead 5-4 in the second set, with Djokovic serving, Kohlschreiber hit a forehand winner and then forced a rare backhand error at 30-all to earn a set point.
Djokovic, however, fended that off with what he later called a "really good" forehand passing shot winner to get to deuce, then held serve for 5-all and broke in the very next game to regain control.
"Managed to win that set, which was crucial," Djokovic said.
Next up for the Serb, who reached the US Open final each of the past four years, will be a match against 2012 US Open champion Andy Murray.
Murray pulled out the sort of tough win he had been missing this year, beating Jo-Wilfried Tsonga in three long sets in the fourth round. The eighth-seeded Murray needed 2 hours, 35 minutes to defeat the ninth-seeded Frenchman 7-5, 7-5, 6-4 on a hot, humid Monday afternoon.
Tsonga had three break points to go up 3-0 in the final set, but Murray fought them off to swing the momentum. He promptly broke in the next game to get the set back on serve, and then closed out the match with another break.
"I don't feel like I'm that far away from playing my best tennis," Murray said.
Murray hasn't been back to a final since becoming the first British man in 77 years to win Wimbledon in July 2013. He beat Djokovic to clinch that title and also defeated him at the 2012 US Open for the first Grand Slam championship by a British man in 76 years.
"Great memories from that match," Murray said in an on-court interview. "Hope we can play another top-level match."
When Murray's ranking slipped after the surgery, it left him vulnerable to this sort of draw: He could potentially play Tsonga, Djokovic, Wawrinka and 17-time major winner Roger Federer in the last four rounds. The third-seeded Wawrinka beat 16th-seeded Tommy Robredo 7-5, 4-6, 7-6 (7), 6-2 on Monday.
The 16th-seeded Spaniard had a chance to serve out the first set and had two set points in the third, but Wawrinka rallied both times, and then dominated the final set.
"That's why I'm normally so strong, because I know that I have [a] few lives," Wawrinka said. "Even if I can feel really bad, I always find solution how to get better, how to relax physically, and at the end I was feeling good."
Leading 4-3 in the third, Wawrinka chased after Robredo's overhead and realized he was about to crash into the barrier behind the sideline. Wawrinka hurdled it and landed on some spectators.
He quickly scrambled back onto the court and stayed down on his knees for a few moments. After walking over to his chair, he stretched his right leg, and then rotated it around.
Once play resumed, his movement seemed fine. The trainer had already been working on that leg during changeovers.
Wawrinka, who likes the intimacy of Louis Armstrong Stadium, said he had never crashed into the crowd like that before.
"It was quite a bad fall," he said. "But I'm lucky I didn't have any big problem with that. I was already struggling physically, so was nothing from the fall."
Robredo upset Wawrinka's Swiss Davis Cup teammate, Federer, in the fourth round at Flushing Meadows last year. He came into Monday's match with a 6-2 record in this series, though Wawrinka beat him in Australia in the same round on his way to his first major title.
Frustration started to boil over for Robredo after he failed to capitalize on his chances in the third set. The two players exchanged words, though they wouldn't say later what it was about.
"It's something that can happen in a match," Robredo said.
The Associated Press contributed to this report.