1) STOP + TO + VERB = To STOP + DOING another action.

I met Brian in the street, so I stopped  to  talk to him.

2) STOP + VERB-ing = To STOP DOING an action.

I saw Brian in the street when I was with Claire and I stopped talking.

3) STOP someone FROM doing something = To PREVENT someone FROM doing something.

Claire stopped me (from) talking to him.