They can be a bit fickle!
If cleaning the laser lenses with a proprietory CD lens cleaner that uses tiny brushes), and a SMC reset:
Resetting the SMC (System Management Controller) on Intel-based Macs:
Resetting your Mac's PRAM and NVRAM:
doesn't do it, then buy an external DVD burner. I got a Samsung costing less than $40 which works perfectly!