You must have your I-140 approved before H1 expiration.
Then you can extend H1 for 3 years. Forget about the pending > 365 days for the 1-year extention, you are no longer eligible.
Then you can extend H1 for 3 years. Forget about the pending > 365 days for the 1-year extention, you are no longer eligible.