Generally speaking, if you file an immigration petition and the USCIS sends you an acknowledgement, during the duration of the processing, you are deemed to not accrue unlawful presence. This is different from lawful status. Is your head spinning already? Okay, lawful status means that you are legally in the United States. On the other hand, lawful presence means that you are merely present lawfully but have no legal status. The distinction is very important because it can have a huge impact on adjustment of status and whether or not you are barred from entry into the United States for a specific period of time.
In a very important case, it has now been decided that if you file for H1B extension and in case it is denied, you will be assumed to have been illegally in the United States since the day your original H1B status expired. Ouch! The right way to deal with this is to file your paperwork as soon as possible so that you are always in status. Being out of status is a huge complication that you do not want to have. However, in case, your application for extension is not approved before your status expires, consult with your attorney as to the next steps. You maybe better off leaving the country rather than accruing unlawful presence.