Budget.
When the dses were little, we used to overspend - we'd end up dipping into the overdraft facility each month, and spent on the credit card too. When dh got his bonus, we'd get back on an even keel, but it never lasted.
Eventually we sat down, and wrote a detailed budget. Fixed outgoings such as the mortgage, utility bills, insurance etc were all deducted from dh's take home pay as soon as he was paid (even if they were not going out until later in the month). Then what was left was divided up into separate amounts for different things - weekly budgets for food shopping, petrol, spending money for dh and me, and family fun (days out, takeaways, cinema etc etc).
Initially we kept meticulous records - we had sheets for each of the weekly budgets, recorded every expenditure, and kept receipts so we could check back if necessary. If we had an unexpected expense, dh would juggle money between the different budgets, but the aim was always to stay within the weekly amounts.
As time went by, we got better at the budgeting, and we don't have to keep paper records any more - though dh does have a spreadsheet, and budget forecasts, and keeps an eye on the bank account (internet banking has been a real boon), to make sure we aren't going mad.