Costa Rica twice took the lead and pushed the United States to a 2-2 draw in regulation before falling 5-4 in a tense penalty shootout, exiting the Gold Cup after a determined performance that forced their opponents to the brink in a memorable quarterfinal.