How should I change the following to indirect speech?

He said, "You had better finish it now."

The question is what the "past tense" of "had better" is.
You had better have finished it.

To change something to indirect speech you need to find a way to take the quotation marks out of the original. That does not always mean using the exact same words as the original. (that is why it is know as "indirect" speech!)

The Vicar said, "let us pray". = He invited us to pray.

The teacher said, "Get out your books". = The teacher told the students to get their books out.

He said "We need a sense of urgency about this". = He encouraged people to develop a sense of urgency about (it)

It seems
a)you need someone who is being told to finish,
b)phrases like "had better" are the sort of idioms which are likely to get dropped in the switch from direct quotation to indirect reporting, in favour of the meaning of the phrase.

for instance - He said, "You'd better finish it now".
could be reported as - He told (them) that they had to finish their (project) immediately.
or He told (them) that they had to finish (it) straight away.

If you say:
"He told them that they had better have finished it." then the meaning changes significantly.
Students: Are you brave enough to let our tutors analyse your pronunciation?
I think ' had better ' is a fixed term used as present or past tense.
 rommie's reply was promoted to an answer.
 suzi's reply was promoted to an answer.
Site Hint: Check out our list of pronunciation videos.
Good point. I withdraw my earlier comment. Suzi is right, as was WHL

What you need is: "He said (that) I had better finish it now.", or a rewording such as Suzi described.

Apologies for not reading the question properly.