You have several options:
if late in the year you know that you will be writing a check to the IRS and the state, you could change the W-4 withholding to have extra funds withheld from the last few paychecks. That can be difficult to do if you mess the deadline to change the last paycheck or two. Also remember to change it back in January.
If you want to wait until the year is done, you can file an estimated tax form due in January. You still will be writing a lump sum check to the IRS, but it does avoid penalties.
If you have a reasonable expectation of being in this situation every year, then have additional funds be withheld over the entire year to make the safe harbor level. In a nutshell you make sure that you have enough withheld to meet the previous years tax obligation.
From IRS Pub 505
Who Must Pay Estimated Tax
If you owed additional tax for 2021, you may have to pay estimated tax
for 2022.
You can use the following general rule as a guide during the year to
see if you will have enough withholding, or should increase your
withholding or make estimated tax payments. General Rule
In most cases, you must pay estimated tax for 2022 if both of the
following apply.
You expect to owe at least $1,000 in tax for 2022 after subtracting your withholding and tax credits.
You expect your withholding and tax credits to be less than the smaller of:
a. 90% of the tax to be shown on your 2022 tax return, or
b. 100% of the tax shown on your 2021 tax return. Your 2021 tax return must cover all 12 months.
Note. The percentages in (2a) or (2b) just listed may be different if you are a
farmer, fisherman, or higher income taxpayer. See Special Rules, later.
But there is an additional provision for people with high incomes:
Higher Income Taxpayers
If your AGI for 2021 was more than $150,000 ($75,000 if your filing
status for 2022 is married filing a separate return), substitute 110%
for 100% in (2b) under General Rule, earlier.
For 2021, AGI is the amount shown on Form 1040 or 1040-SR, line 11.
If you make sure that you use the W-4 to make the previous years tax (or 110 % of the previous years tax) you can avoid penalties for a large check. However you do have a good chance of getting a large refund if the year turns out to be a low income year. If it turns out to be an excellent year bonus wise, even if you write a check, the IRS won't be looking for a penalty.