I tried just keeping it in a tightly-closed container in the refrigerator, but soon it was moldy.
I've read this question, which seems to indicate that ordinary butter should keep safely for weeks at fridge-temperatures... But my preparation is hardly ordinary butter.
My technique is very simple: 200g butter in boiling water and 30g of chopped herb (a mixture of leaves and buds) An hour of boiling, strain the herb with a filter gauze and put the liquid in the refrigerator until the fat solidifies and can be easily separated from the water.
Freezing is something I've considered trying, but would this affect the texture, or otherwise damage flavor?