Changed job with H1B transfer filed before I-94 expiry, does 240 day limit still apply if i94 expired and transfer result pending?

I am working for Employer A in H1B status.

Employer B filed an H1B extension and transfer (change of employer) petition for me.

If I start working for Employer B based on the H1B transfer receipt number, and then my I-94 expires, do I have to stop working and leave USA after 240 days?

Yes, you can keep working with Employer B even after 240 days have passed and your H1B transfer application is still pending result.

The 240 day limit only applies to H1B extensions that are for same employer.

In your case, you are changing employer from A to B and hence, you do not fall in 240 day limit criteria.