It is usually wise to go to a different school from your undergraduate institution in order to gain an alternate perspective. Personal reasons might limit your flexibility, though, and staying at your strong undergraduate institute is not a disaster.
If you are not restricted to the immediate area, apply to your undergraduate institution as a backup, but consider a variety of top departments. For example, computer science students might consider Stanford, MIT, University of California Berkeley, Carnegie Mellon, Cornell, Princeton, University of Texas Austin, University of Illinois Urbana-Champaign, University of Washington, University of Wisconsin, Harvard, California Institute of Technology, Brown, UCLA, Yale, University of Maryland, University of Massachusetts Amherst, and Georgia Tech. Even better, talk to a faculty member who does research in an area that interests you and ask for advice about the best schools in that particular subject. The list is often quite different from the list of strong departments overall.
Departments are ranked in a (quirky) yearly survey by U.S. News and by publications of the National Academy of Sciences.
Apply to several departments: there is an element of luck in the admissions process, and for each research interest, there are a number of strong schools that are good choices.
See Section 14.10 for some helpful links.
The application process provides a tremendous amount of data to a department admission's committee, but people who have served on such committees can tell you that there is still a large element of uncertainty in sorting out the strongest applicants.
Different departments put different weights on the various components of the application, but here is what an ``ideal'' application might look like:
If you come from a small college that doesn't have a strong program, the admissions committee will be asking questions such as these: Did the student make the most of the opportunities provided at the college? (Evidence might include taking the hardest courses, doing a senior thesis, or doing an internship.) Do the letters say that this student is a self-starter, has gone beyond the course material, or is among the best students at the college? Is the student ready for our graduate level classes? Does the research statement indicate a focus and a motivation strong enough to sustain the transition to a ``bigger pond"?
If you are not admitted to the department you want, you might work your way up the ladder by obtaining a master's degree at the best institution that admitted you and then reapplying to PhD programs.
Suppose you are in the lucky position of being accepted to more than one graduate program. How can you decide which offer to accept?
Let the department know when you plan to arrive. Arrange to tour the facilities and talk to one or two professors and a few graduate students.
Wander around on your own, too. Visit the computer labs, the library, the bookstores, etc. Get a feel for how well the department and the school function.
Ask lots of questions--about the program requirements, the research strengths, the climate for graduate students, housing--about whatever is important to you. Trust your instincts: if the department feels wrong for you, it may well be!