Yahoo failed because they were out-innovated. They weren’t the only ones. Lots of highly successful search engines got their lunch eaten by Google. Yahoo also suffered from a lack of leadership and some very poorly conceived acquisitions.
I don’t see any of that with Facebook. In fact it’s the opposite- people are uneasy with how effectively they’ve acquired users and their data and monetized it.
Further, they’ve pretty much only made incredibly savvy acquisitions and managed their integration into the Facebook ecosystem masterfully. Instagram not only exists today but has quickly become arguably the most valuable property. What about Tumblr? Flickr?
Say what you will about the ethics of the company but Facebook has demonstrated they have vision and the ability to execute and adapt. Yahoo didn’t. Most companies don’t. They have their existing business and customers and exist as long as the winds don’t change.