Lin faced the prospect of a shock exit as he was taken to three games and hauled back to 15-13 in the third after conceding five successive points, but he held on.
The second seed's eventual 75-minute 21-12 16-21 21-16 win kept the man widely regarded as the best player of all time on course for a repeat of the Beijing 2008 final against Lee Chong Wei.
Top-seeded Malaysian Lee, looking increasingly assured in his recovery from an ankle injury, was troubled only in the first game before seeing off India's Kashyap Parupalli 21-19 21-11.
The semi-final line-up was completed by China's third seed Chen Long and seventh seed Lee Hyun-il, of Republic of Korea.
Chen saw off Peter Gade, the Danish veteran playing his fourth and last Olympics, 21-16 21-13 while Lee stunned fourth seed Chen Jin of China 21-15 21-16.
Three Chinese women will feature in the last four of the women's Singles along with Saina Nehwal of India.
Nehwal, the fourth seed, came through against Europe's top player, Denmark's Tine Baun.
Top seed Wang Yihan brushed off Cheng Shiao Chieh of Chinese Taipei 21-14 21-11, Wang Xin avoided an upset to beat Thailand's Intanon Ratchanok 17-21 21-18 21-14 and Li Xuerui overcame Hong Kong's Yip Pui Yin 21-12 22-20.
China are guaranteed at least one gold as top seeds and world champions Zhang Nan and Zhao Yunlei set up a final with number two pair Xu Chen and Ma Jin in the Mixed Doubles.
Both came through three-game battles against Denmark's Joachim Fischer and Christinna Pedersen and Indonesia's Tontowi Ahmad and Liliyana Natsir respectively. For the first time in Olympic history, Indonesia now cannot win a Badminton gold medal.
In the women's Doubles, Tian Qing/Zhao Yunlei and Mizuki Fujii/Reika Kakiiwa will face each other after respective victories against Valeria Sorokina/Nina Vislova and Alex Bruce/Michele Li.
Bruce and Li put up the strongest fight, going down 21-13 to the Japanese in the third game.
The men's Doubles competition is heading for the semi-final stage.
Top seeds Cai Yun and Fu Haifeng won their all-Chinese clash with Chai Biao and Guo Zhendong to set up a meeting with Malaysia's Koo Kien Keat and Tan Boon Heong.
The other semi-final will be between second seeds Chung Jae-sung and Lee Yong-dae and Denmark's third seeds Mathias Boe and Carsten Mogensen.