Afghanistan put on a tremendous show to enter the semifinal of the ICC Under-19 Cricket World Cup by beating Sri Lanka by four runs in Coolidge.