Cocaine typically stays detectable in urine for about 2 to 4 days after last use for light or occasional users. For heavier or chronic users, detection in urine may extend up to a week or even longer in some cases. The main substance detected in urine tests is a cocaine metabolite called benzoylecgonine, which lasts longer in the body than cocaine itself. Detection times can vary based on factors such as dosage, frequency of use, individual metabolism, and body composition.