The local authority has leased and run the garden for 25 years but planned to end its lease, while the university said it had no strategic need for the garden.
Now the parties have agreed a business plan, which will see a £50,000 reduction in the estimated £300,000 budget over the next council budget cycle.
New director James Hearsum said: "We're very happy with the business plan and I've been appointed to deliver it. It's a five-year arrangement that will be reviewed with a view to putting in a very long lease."
Hearsum will appoint a marketing manager to try and increase the garden's visitor numbers from 25,000 to 40,000 a year. He will also reduce the glasshouses not seen by the public.
The University of St Andrews is set to lease its garden to a trust at a peppercorn rent of £1 so it can be maintained as a viable attraction and more events can be run.