Ben Stokes was twice dismissed by no balls after Sri Lanka spinner Lakshan Sandakan overstepped two times in three overs.