Think of how B perceives it:
B: ... think think think think think think think—Sorry, what did you say?
A: [blah blah]
B looks back and thinks of A's utterance as an event which is completely done, finished. Linguists call this view of an event the perfective aspect. Perfective aspect in the past is expressed using the past form of a verb, You said or You did say.
That event, A’s utterance, occurred at a time when B was in a state of thought which started before A's utterance and ended sometime after it. Linguists call this view of a state imperfective aspect. Imperfective aspect is expressed using a progressive construction; in this case, since the state lies in the past, B uses the past progressive construction I was thinking.
Perfect constructions like I have thought and I have been thinking express a state which arises from a previous event and is current at the point in time which you are talking about. Linguists call that time you are talking about reference time (RT). A present perfect construction has the present as its RT: it expresses a state which is current now, at the time of speaking. Since B is talking about a past event, his† RT is the past; in that context a present perfect cannot be used.
A past perfect construction expresses a state with a past RT, a state which was current in the past, so you might think that I had thought or I had been thinking would be appropriate here. But the perfect construction does not express a state denoted by the lexical verb (think) in the construction, it expresses a state which arises from the state or event denoted by the lexical verb. B is not talking about the result of his thinking, he is talking about the thinking itself—so a past perfect construction doesn’t work either.
There is more about aspect here, and entirely too much about perfect constructions here. Be careful not to confuse perfective aspect with perfect constructions—they are entirely different things.
† I make the appallingly sexist assumption that A is B’s wife, only because that’s how this conversation always plays out in my own household.
Keep in mind that a present perfect casts its predication in the present tense. It does not narrate past events, it mentions past events which give rise to a present state.
That is why formal English does not permit a present perfect to be used with a temporal adjunct which does not include the present moment, the Speech Time at which the sentence is uttered. (You will occasionally find this rule violated in improvised, conversational discourse; but even there it is comparatively rare.) Thus, this is acceptable:
okI have often visited London.
But this is not:
∗ I have often visited London in the 1990s.
Today, in the 20th century is a timeframe which excludes the present. Consequently:
Sentence 1) is acceptable if it appears in a text written in the present century, but would be of questionable acceptability if written fifteen years ago.
Sentence 2) is acceptable if it appeared in a text written during the 20th century, but it would not be acceptable if written today.
There is a great deal more about this at What is the perfect, and how should I use it?, especially §§ 3.1 Grammatical meaning, 3.2 Pragmatic meaning and 4. When and how should I use the perfect?.
∗ marks a usage as unacceptable
Best Answer
First, just a correction in your first sentence:
I couldn't find my keys and asked my friend where they were. (Because "couldn't" is in the past tense.)
It might sound even better (to a native-speaker) to say:
I couldn't find my keys, so I asked my friend where they were.
And, in this context, in your last sentence, I would say "the same thing," not "the same." "The same thing" is more idiomatic.
Now, to answer your question...
This definitely doesn't sound right to me as a native speaker. It sounds like the events followed this timeline:
You realized you lost your keys.
You thought they were in your trousers.
You stopped thinking they were in your trousers.
You friend suggests they might be in your trousers.
This is the response I would use. This has the following timeline:
You realized you lost your keys.
You begin thinking they might be in your trousers. And then your friend says...
Your friend suggests they might be in your trousers.
This response might be appropriate. It implies that you've been thinking for a relatively long time that your keys are in your trousers.
You realized you lost your keys.
You think they might be in your trousers.
Some time passes, and you continue to think they might be in your trousers, so you ask you friend, and he says...
Your friend suggests your keys might be in your trousers.
This sounds very peculiar. This would mean:
A long time ago, before you ever lost your keys, you have had the thought that your keys might be in your trousers (like, you're psychic or something haha).
You realize you lost your keys.
You ask your friend, and he says they might be in your trousers.