How to get "right" withholding - state is good but fed is WAY off

My wife and I file jointly and we both have decent incomes. But we can't seem to get the right W4 withholding. This year our Rhode Island REFUND was $159 but we OWED $3600 to the Feds. It has been like this for the past few years. And there were a few years before that where it was the opposite, we got a modest federal refund but owed a lot to the state. 

 

We were even tagged with a penalty this year for underpayment on our fed taxes.

 

How do my wife and I calculate and file W4s that get us close(er) for both fed and state?

 

Note that we still have 3 child dependents