I am not sure if I should put 跟 before 在 or the other way round. For example:
我跟朋友（一起）在饭馆吃饭 or 我在饭馆跟朋友（一起）吃饭
Can I use both, but the meaning is slightly different?
Lets just simply translate this into English.
我跟朋友（一起）在饭馆吃饭: I'm here with friends in the restaurant eating.
我在饭馆跟朋友（一起）吃饭: I'm in the restaurant eating with friends.
So the answer is, both are correct grammatically, both means the same, depends on which one you like to use.