Can I stay in US if my H1 extension is in progress and my H1B visaaa expires?

Do I need to leave US since my H1B visa is getting expired? My employer has already filed H1 extension in premium and it is still in progress. What if USCIS replies after my H1B visa expires, am I still legal to stay in US?

yes, till USCIS makes a decision on your extension rejection, you are legal to stay. But if USCIS rejects your application, you must leave immediately.