How to imitate Ambient Occlusion in Cycles?
The future

There is a very easy way for versions of Blender compiled after last June: not just Blender 2.8 but also Blender 2.79's "latest builds" that you can download from the Blender Builder («These builds are not as stable as releases, use at your own risk.»).

The Ambient Occlusion node

This is the effect of the Ambient Occlusion input on a Emission Shader node: the plane looks entirely flat without AO, despite having a complex geometry (there is no other source of shadows; in fact, the scene has no lights apart from the plane itself). Cavities become evident with AO:



It can be made dependent on the local object only by ticking "Only Local".

Where to use it

You should use a MixRGB node in the Multiply mode to darken whatever color input you have with the "blacks" coming from the AO socket of the Ambient Occlusion node.



More on the Ambient Occlusion node

...in this video from the Blender Developers.

The past

There was a very preliminary "node based" solution also in the stable release, but the old Ambient Occlusion node outputs an Emission-like BSDF (), not a Color () or a Fac (). This makes it basically impossible to add your AO on top of other shaders.

It also doesn't have parameters!



It is basically only good for baking textures, or for shadeless visualizations.