The writing sample is perhaps the single most important part of the application. Almost always, it is what will decide an application's fate. An application with a poor writing sample, but stellar letters and grades, will gain acceptance almost nowhere, since the poor quality of the writing tends to undermine one's confidence in the letters; but one with middling letters and an excellent writing sample might still stand a chance. (Strong grades are just assumed here: The writing sample won't get read if the grades are mediocre.) It is, therefore, not a good idea simply to select some paper that got an 'A' and submit it unchanged. You should, rather, look upon the task of producing a writing sample as if it were an additional course and plan to devote a fair amount of time just to this task.
It is, for this reason, also rarely a good idea to submit a paper one is writing for a course taught in the fall of the senior year (if that is when one is preparing the application). There is just not enough time to polish such a piece for inclusion as a writing sample. A better idea is to use a successful paper written in the junior year as the foundation for your writing sample, and then to work on it further, doing additional reading, polishing the arguments, getting feedback on drafts, and so on and so forth. You can begin this process by discussing the comments you received on the paper with your instructor. Note that this is also a good way to strengthen your relationship with that instructor and so to give them a solid basis for a letter of recommendation.
A good writing sample addresses a substantial philosophical problem, whether it amounts to a critical evaluation of an argument or a serious attempt to interpret difficult philosophical texts. Mere reports of what some philosopher or other thinks—or mere 'compare and contrast' efforts—are not likely to impress. Do not, however, think that you have to make an original contribution to the area about which you are writing to produce a solid writing sample. Very few undergraduates are capable of writing such a paper. Still, though, you should be thinking for yourself: We want to see that you are able to do philosophy, not just talk about it.
Mostly, admissions committees are looking for two things: promise and a solid basis from which a student can start learning to do original philosophical work. What the writing sample should demonstrate, then, is that you have acquired the basic skills needed for the serious study of philosophy: An ability to read and write philosophy and to think critically and creatively about philosophical problems.
The writing sample needs, as was said, to be a substantial piece of work. It should therefore be at least 12–15 pages long, as it is hard to do anything serious in less space. It should not be excessively long: The members of admissions committees, being human, have been known to get annoyed by overly long writing samples; they simply do not have the time to read 40 pages from every applicant. Rarely will there be any reason to go over 20 pages, and 25 pages is probably an absolute maximum. Generally speaking, it's not a good idea, either, to submit a longer piece of work, such as a senior thesis, even if you indicate to the committee that there is some portion of it that you would really like them to read. It is far better to re-work the relevant material so that you can be sure it is self-contained.
It is permissible to submit more than one sample of writing, but you should not do so unless you have some very good reason. (An example of a good reason: You have serious interests both in the philosophy of language and in Aristotle.) If you do submit more than one sample of work, you should indicate which of the pieces you intend as primary and which as supplemental, in case the committee deems itself unable to read everything (as is likely).
You should be absolutely certain to proofread thoroughly: Do not trust spell-checkers and the like to do this for you. It is a good idea, too, to have friends read through the paper and comment upon your style, grammar, and so forth. The paper needs to be well-written: Being able to write well is an absolutely fundamental prerequisite for graduate study. (You will learn to write better as a graduate student, but you need to have a solid foundation already.) Make sure, too, that your citations are in good order, that quotations and footnotes are properly formatted, and so on and so forth: You want your paper to look as if you've spent real time with it—and as if you are proud of it.
Finally, the writing sample does not have to be connected, in any way, with the area or areas you think you most want to pursue in graduate school. So long as your record shows a sufficient foundation to pursue those areas, a writing sample in some other area might even impress the committee as a demonstration of your philosophical breadth. Your faculty advisers can help you choose a paper that would be appropriate for a writing sample.