This article is from the FAQ, by with numerous contributions by others.
You must apply to your foreign student advisor for an F-1 extension within
30 days preceding the expiration of your I-20AB. You are eligible for an
extension if 1) your application is timely; 2) you have maintained your
status without violation; and 3) you can demonstrate that the need for an
extension is due to compelling medical or academic reasons.