What can be added to non dairy milks to extend shelf life?
This question has two facades:


First get rid of the already-there spoilage microorganisms.


Before blending the nuts, I soak them in vinegar for a while and rinse thoroughly. And always using sanitized equipment and boiling the water (and sugar if you're adding) is quite a good practice to kill the microorganisms you might have in your ingredients.


Prevent (or at least postpone) future spoilages.


If you have a sous-vide setup, using the lowest pasteurization temperature at 54C you can try to pasteurize. Please check some charts on this. It's hard to give an estimate without knowing your container sizes.
Some nut-milk can handle acidity, some can't you can experiment with that as well.