We use reflexives pronouns such as "himself" with the preposition "by":
- to show that someone did something without any help:
The children got dressed by themselves.
I prepared the whole meal by myself.
- to show that someone was alone:
He lived by himself in an enormous house.
She walked home by herself.
In general, it is usually not necessary to use the preposition "by" with a reflexive pronoun because the pronoun actually suggests that an action was performed by the subject of the sentence (the person the pronoun is referring to).