Which sentence is grammatically correct lay or laid in this situation?

Solution 1:

Your first sentence is correct: your second is incorrect.

Lay and Lie are two different verbs. In everyday spoken English they regularly get mixed up, perhaps because both may be followed by the word on, and because - annoyingly - the past tense of lie is lay.

Lay is a transitive verb. That means it takes a direct object.

I go in and lay the papers on the desk.
He is laying the table for dinner.
She laid it yesterday.  
When he had laid the table he left.

Lie is an intransitive verb. It doesn't take a direct object. It is like yawn. You don't yawn anything and you don't lie anything.

I lie on the bed, reading.
She was lying on the lawn.
She lay there all day.
When he had lain there for an hour he got up.