Take a look at this file :-

/etc/default/acpi-support, a few things are important there.
Make sure LID_SLEEP=true.
If it has been commented, uncomment it.