1. People became close when think alike.
2. People became close when they think the same way.
You're speaking about about pepole in general (basically all people) and not any specific people. When speaking about things in general, you use present tense, not past tense. This means you should say 'People become close...'
If you are speaking about specific people, you should put 'the' in front. So, 'The people became close' which makes sense. Then 'think' should be past tense.
'The people became close when they thought...'
Also, the first sentence should have a 'th' front of 'think'.
So, People become close when they think alike
People become close when they think the same way.
Finally, the first sentence is better because the words 'think' and 'alike' are often put together. 'To think alike'.
There is a saying - 'Great minds think alike'
Courtney's answer is excellent.
I will just add:
"People become close when they think alike." - formal/higher level because of the word 'alike'
"People become close when they think the same way." - informal / they way people normally speak