Pretty much everyone has been faced with the fact or risk of a petting getting away from them. I have had one of my dogs make it a few houses down before I noticed and called her back, and three of my cats have managed to get out of the house at one point or another; one of them was missing for two weeks before we saw him and coaxed him back in. And that's why all of my pets have microchips.
If you're not familiar with this, it's a pretty fast and easy way to permanently identify your pet. A chip the size of a grain of rice is quickly implanted with a needle under the skin between the shoulder blades. Most pets don't object to this, though it is admittedly a large needle, and it's over in a couple of seconds. This chip is inert and won't affect your pet in any way. If he or she ever gets lost, a shelter or vet can use a scanner to find out of a chip is present. If so, a unique identification number will pop up and the vet can then call a phone number and find out who that chip is registered to. The microchip is difficult to find once implanted, so a stranger can't easily even locate it to remove it. Any vet or shelter will have a scanner and should be checking all strays.
Microchips are in my opinion the best form of identification available. Collars and tags can come off or be lost. Tattoos aren't standardized, and don't provide a way to find the owner. Microchips are safe and effective, and best of all are unique and permanent.
Costs can range quite a bit. In my practice we charge $24.95 to implant, and this includes lifetime registration. I have seen implantation cost as much as around $50. With some microchip manufacturers there is an additional charge (usually $10-15) to register your information when you first have it implanted and then any time your address or phone number changes. I have known many shelters that will include microchip implantation in the cost of the adoption.
Most of the world uses an ISO (International Standards Organization) compatible chip that has a frequency of 134 kHz. Unfortunately in the US, there has been a lot of controversy in the last several years. Historically the microchip manufacturers have used 125 kHz chips in America, and there have been only a couple of companies. About six years ago some new manufacturers began to come out with the ISO chips in the US, which created a lot of problems, as most of the shelters had scanners that could only read 125 kHz chips. The 134 kHz chips can be read quicker and from a greater distance than the 125 kHz ones, but it's hard to change tradition. Various manufacturers fought hard against a switch, even though the AVMA, ASPCA, American Humane Society, and many other groups had endorsed the ISO chip over the 125 kHz, and the government had in principle agreed to using the 134 kHz chips. To make a long story shorter, the last six years have been hard in the use, but there are finally more ISO chips available, and most shelters and vets have universal scanners that can read any chip out there. I definitely recommend the 134 kHz over the 125, though your vet may only use the latter.
Unfortunately, only a small percentage of US pets have microchips, and only a little larger percentage in other industrialized countries. It's inexpensive and may be the only way to get a lost pet back. Talk to your vet about the costs and procedures, as I strongly recommend having it done.