The dependent clause who had stolen the gun should be placed as close as possible to the noun it modifies man.
Correction #1: The man who had stolen the gun turned himself
in. (The dependent clause is restrictive, needed
to identify which man we mean.)
Correction #2: The man, who had stolen the gun, turned himself
in. (The dependent clause is non-restrictive. Which
man we mean is already identified by the surrounding context, and
the dependent clause merely adds
information.)
To see more about modification, consult the LARC Electronic Writing Center Grammar Checklist.