"Don't talk to the cops - ever" is not always and without exception the best advice, as Tallpine relates. But it does pay to think about what you are going to say to the cops before you open your mouth and let words tumble out. For example, what you were doing when you saw Person X commit the deed the cops are interested in probably should not be shared with them unless Person X did that thing to you and what you were doing bears on your being not guilty of a criminal act yourself. My favorite example is the guy I interviewed while he was in prison for drug distribution - he got caught because he was a witness to a break-in and told the cops "I was just sitting there in the alley behind the 7-11 smoking a joint when I saw that dude crowbar the back door open."
But if the cops are asking you questions about something they think you did? As the Supreme Court recently decided, it's necessary to pipe up and say "I invoke my Miranda rights and want my lawyer here," so tell them that. My attorney friend (and most likely to be my criminal defense attorney again if I ever need one) has a neat bit of writing you can use so you do not forget anything important and so there can be a paper trail:
http://www.virginialegaldefense.com/tempname/LetterToCops.pdfHe recommends both full-size, half-size, and a laminated wallet-size to carried at all times.
stay safe.