Cycles, Using Ambient Occlusion as a Factor in Material Node Editor
In the node editor Shift + A then under input you'll find Ambient Occlusion, the node itself shows in the image above, you can use AO output as a factor to feed to a Mix Shader node or a MixRGB node or... whatever you would use a factor for.