The meaning is different to some extent.他去北京看了朋友.It means that "he" went to Beijing,and he visit his friend.But “他去北京看朋友了”.It means that he went to visit his friend,and his friend is in Beijing,so he need to Beijing.Actually, the difference is so small that it wont‘t be emphised in daily conversation.