H1B petition approved. What will happen if I renew my passport before stamping?

My H1B petition has been approved but the visa has not yet been stamped. My employer is currently looking for a suitable position to fit me in. However, my passport is going to expire soon. What will happen if I go for the renewal of my passport now? As the passport number will change, will it affect the application as that was made using the current passport number.

It is no problem as long as your visa has the new passport number and not the old one. You will need a new passport anyway, just make sure it is processed the fastest way possible.