my mom accompanied us to Canada 2 weeks ago for 3 days visit. She is on B2 too. we were back to US 3 days before her B2 visa expires. (her I-94 valid through mid of August).
we consulted the same question with several lawyers before we visited Canada. Some lawyers said before visa expiration , some said before I-94 expiration is fine. So we took the safe one.
good luck.