One of the best methods for maintaining unaltered cognitive functions, or rather, for maintaining mental health and judgment, is good sleep and adequate nutrition
Then the most important would be sports or regular physical exercise. Even in times when you don’t feel like it or are going through stressful periods and don’t feel like physical exercise, you should practice running, cycling or any form of sports or physical exercise.
A third method would be supplementation with nutritional supplements beneficial to the brain such as zinc, Ginseng, B-complex vitamins and other supplements.
Reading also helps a lot, but also games like chess, Rummy, or other games where you have to put your mind to work.
There would also be other methods such as handwriting, socializing or spirituality.