It does it just to tick you off! It probably likes to do it the most around 3AM. Am I right?
All joking aside...
The most common cause of nuisance alarms on home smoke detectors is dust.
I would consider using a vaccum cleaner attachment on the unit. The can of air suggestion someone made can work good too. But not everyone has these.
Replacing the battery is never a bad idea if it's been awhile. But I've personally never seen a battery replacement fix a detector that was sounding falsely. Just the ones with the case of the "chirps", which is meant to signal a low battery.
Is the unit connected to other detectors in the house? Newer homes often include this feature, but the drawback is if one goes off, they all go off. So it can be tricky to find the culprit in a "false alarm" situation. If this is the case, you may have to clean them all. If that doesn't do it, I'd get one replacement unit and start "chaging them out" one at a time, until they shut up!
If it's a stand alone detector and cleaning doesn't do the trick. I'd just get a replacement and pitch the thing. I think it would be $10 well spent.
15+ years as a fire protection designer