Such behaviours do decrease with age for most children. You can best help him by bringing him to see a psychiatrist or psychologist for assessment and appropriate treatment. Perseveration is a symptom. We need to identify the underlying disorder. By treating the underlying illness, the symptoms (including persevation) will decrease. Meanwhile, as a parent, here are some tips:
i) Talking about it: talk to the child when he is not perseverating, describe the observed behavior and situations in which it causes problems.
ii) Empathic understanding - this will reduce anxiety and calming down may help in getting the child unstuck
iii) Self-monitoring to learn and identify potential triggers and also what helps him to stop
iv) Create a "stuck signal" - a simple phrase or action to let him know when he is stuck.
v) Create a plan to get "unstuck" - identify things he can do when the "stuck signal" is given. Eg. a time-out, doing another activity etc.