As long as the person subsequently gets OPT or roll into another valid status prior to their AOS application being adjudicated. Simply applying for AOS during the 60 days grace period does not keep one in a valid status.BTW, since you need a valid status to adjust from, if you graduate you can't apply for AOS after your current status expires until your OPT application is approved. So although you can lawfully stay in US while your current status has ended and your OPT is pending, you can't file a new AOS application until your pending application is approved.
@Sm1smom I understand that you can fill form I-765 (for OPT) from 90 days before until 60 days after the end date of your program on your form I-20. Does the same apply to form I-485 as well, i.e can one fill form I-485 until 60 days after the end date of the study program?