I just got back home from a friend's house I went over to.
I just got back home from a friend's house I had gone over to.
Are both the above sentences grammatically correct? What's the difference in their meaning?
English Language Learners Stack Exchange is a question and answer site for speakers of other languages learning English. It only takes a minute to sign up.Sign up to join this community
Although I don't see any grammatical misuse in either sentence, in common usage I think most people would just say "I just got back from a friend's house." Since you just got back from that house, there is no need to specify that you had previously gone to it.
If you say "I had gone over to a friend's house.", it sounds as if you are relating it as an event previous to something else that you will also talk about; "I had gone over to a friend's house, and he got a phone call telling him his sister had been in an accident." It's also grammatically correct to use the other construction here: "I went over to a friend's house, and he got a phone call...". But using "had gone over" without something else sounds strange.
Like the present perfect, which is (also) used to make a connection between the past and the present, with the past perfect it's expected to see some sort of link (this time in the past). Remember that when it's clear from the context which event happened first, you can avoid using the past perfect (like in this case, where it's obvious that you went before getting back).
So the present perfect would be useful to say that something, for example, happened before you got to your friend's house:
I went to my friend's house, because I had bought a present for her.