As a student who just graduated from a school whose math department is outside the top 50 and going to graduate school in applied math, I offer the following advice:
Definitely get to know your professors well so they can write recommendation letters for you. One way to do that, as paul garrett mentions, is to take reading courses with professors.
It is important which classes you take: For pure math want to have at least taken classes in algebra, real/complex analysis, and topology. Note that if you plan to go to graduate school in applied math, you would want to take classes in programming, real/complex analysis, numerical linear algebra, ODEs/PDEs, and numerical analysis. Also ask your professors for advice on which classes you should take. The classes I have listed are just the bare minimum. By junior/senior year, you should be taking graduate level math courses if you plan to apply to the very best graduate schools.
Research: Although I cannot speak for pure mathematics, if you are planning to go to graduate school in applied math, try to do research with a professor at your school or a summer REU.
GRE: Most Ph.D programs in pure/applied math will require that you take the Math Subject GRE (which is not the same as the general math GRE). Although recommendations will have the most weight on your application, the subject test should not be taken lightly. In order to prepare for it, re-do problems from your calculus and linear algebra textbooks. For the other 25% of the topics on the subject GRE, look for problems in textbooks. Also try the practice tests online.
Something I really wish I had done as an undergraduate would have been to study material ahead. For example, if you were going to take real analysis in the fall semester, I would find a real analysis book in the summer and try to work my way through it by doing as many problems as I can. Doing this will make classes easier and you learn the material much better.
And if you didn't know already, https://math.stackexchange.com/ is an amazing resource for students learning math.