The semi-final match-up was a repeat of the last year's final in Madrid where Lin prevailed in three sets.
At 19-14 up in the second, Lin seemed home and dry but the gallant Bao won six points in a row to go 20-19 ahead.
With a raucous crowd nearing 10,000 on the edge of their seats, Lin, champion that he is, produced a fine winner to level at 20-20 and clinched victory shortly afterwards.
In Sunday's final, he meets ninth-seeded Indonesian Sony Dwi Kuncoro, who overcame China's sixth seed Chen Yu 18-21 21-13 21-15.
Earlier, women's number one seed Zhang Ning, world champion in 2003, suffered a shock semi-final exit when she was beaten 21-11 21-15 by Hong Kong's sixth-seeded
The Chinese had been heavily tipped to retain her crown after compatriot and titleholder Xie Xingfang was knocked out of the championships on Thursday.
She looked to be fighting her way back into Saturday's match when she led 11-4 in the second set only to subside to a rare defeat.
Wang, who has a good record against Chinese players, told reporters: "I tried to keep the game fast and it paid off."
Her opponent in Sunday's final will be fifth seed Zhu Lin who beat Chinese compatriot Lu Lan, seeded seventh, 21-10 21-13.
Zhang was the latest big name casualty at the championships, headed by the defeat earlier in the week of men's Olympic champion Taufik Hidayat by unheralded Indian Anup Sridhar.