Most Sonic Drive-In locations close around midnight, though hours vary by franchise and some stay open later.
The reliable way to check is the store locator on the chain's official site or a quick phone call to your nearest branch, since a 24-hour location is the exception rather than the rule.