I think the best way is to wear glasses or contacts to keep your eyesight from getting worse. You can also do it by avoiding too much close work. If you are reading or computing, you should look into the distance frequently to re-focus your eyes.
The most important thing you should do is to avoid too much close work such as playing computer or reading. Don't always stay up late and do exercise regularly to keep a healthy body. Your overall health is also important to maintain your vision.