In the longrun he won because
Zhuge Liang died and yes I'm talking about both in the novel and history. Cao Zhen was a wiser military commander of the Wei forces in the West while he was alive, but Sima Yi was more benevolent and knew how to win support of his people well. If you have Adobe ACrobat you can read about Zhuge Liang's Northern Campaigns more in-depth
here.
Zhuge Liang was a better military strategist, but I think Sima Yi was still very, very smart. Easily he is one of the best heroes of Wei.