H1B to F2 - change of status

I am currently on H1B visa(validity until 5/2/2021) with approved i140(completed 6 months with my current employer)
I will be resigning from my job due to personal reasons.

Can I legally stay in US after 5/2 if I apply change of status to F2 before 5/2? (My wife has a valid F1 and her H1 is picked in this years lottery)

Please suggest any other option better than the one mentioned above!