I'm soon planning to visit my friend in the United States for a few days. It's been a long while since I last visited US and at that time, the country I am from was not a part of Visa Waiver Program. As a result, I have a B1/B2 visa that's going to be valid during the duration of my visit. I heard that in order to take advantage of VWP, I'd need to apply for ESTA. From the perspective of time-efficiency, what would make more sense? Also, what's the latest I can apply for ESTA?
Use your visa. You already have a visa, you don't need a waiver nor ESTA.
Entering the US with a visa waiver rather than a visa gives no extra benefit to you than entering with your visa. In fact, the visa allows for a little more freedom than the VWP - a longer stay (up to 180 days instead of 90 days) and the ability to enter the US without having to have pre-booked onward travel.
An ESTA will cost you $21 to apply and is only valid for 2 years. You've already got a valid, paid-for, visa. It doesn't make sense to try to use VWP instead.