、。
You've got to be careful when choosing friends.
Literal
Friends [object-を] choose time-[at-には], pay-attention-must.
The ときには ('when, at the time') uses the composite に+は to topicalize the timing — pulling the time-clause forward as the contrastive frame for the rest of the sentence. 気をつけなければならない ('must be careful') is the obligation form of the 気をつける idiom — direct, slightly bureaucratic, suited to formal advice.