Did Joel lie to Ellie?
Yes, Joel lies to Ellie. This is made clear by the flashbacks that you see while he is telling her the story when she wakes up in the car.
He says that the Fireflies have found many people who are immune to the fungus and that they have stopped looking for a cure. This is clearly not true as he had to forcefully extract Ellie from the operating room before the medical team could kill her to extract the cure from her.
The fact that this is a lie is also undermined by the flashback involving Marlene: She tried to stop Joel in the parking lot when he was carrying Ellie to the car to get away with her. Joel had to shoot her to be able to leave with Ellie.
Why did Joel lie to Ellie?
This is mostly speculation on my part based on the events of the game, but I think there are two reasons why Joel lies to Ellie.
Ellie is determined to finish her "mission".
Over the course of the game there are several dialogues showing that Ellie wants to finish her mission. When they find the giraffes at the bus stop, Joel tells Ellie that she does not need to go through with all of this but she insists on going on:
After all we've been through. Everything that I've done. It can't be for nothing. Look, I know you mean well … but there's no half-way with this.
Also at the final dialogue when Ellie tells Joel about her friend Riley who was bitten and died it becomes clear that she feels guilty for surviving while other people have had to die. It seems she wants to remedy this guilt by doing good and saving the lives of others.
Joel does not want to lose Ellie
Even though Joel always tries to pretend that Ellie is just annoying him, towards the end of the game it becomes clear that they have bonded. The conversational tone between them changes remarkably over the course of the game.
This can be seen by a conversation that takes place relatively early in the game shortly after Tess has died and Joel and Ellie have escaped the soldiers:
Joel: And lastly, you do what I say, when I say it. We clear?
Joel: Repeat it.
Ellie: What you say, goes. sighs
Joel: sighs Good.
Ellie clearly shows that she is attached to Joel when he is about to leave her with Tommy. She gets very worked up about this on the ranch she fled to:
Admit that you wanted to get rid of me the whole time!
Joel is trying to justify his decision rationally but Ellie does not want to hear it:
Everyone I have cared about has either died or left me. Everyone — fucking except for you! So don't tell me I would be safer with somebody else, because the truth is I would just be more scared.
In the end, Joel goes with her even though he pretends he only does it not to upset Tommy's wife who did not want Tommy leaving the family to help Ellie.
Joels growing affection to her is expressed subtly over the course of the game and climates for the first time when he finds her hacking on David in the burning restaurant. He hugs and comforts her and she accepts the comforting. This is also the first time I consciously saw him calling her "baby girl". Note that the only other person he has called "baby" so far was his daughter Sarah.
Ellie is hacking on David's head with a switchblade.
Joel: Ellie! Stop. Stop. grabs her and pulls her off David
Ellie: not realizing who is coming No! Don't fucking touch me!
Joel: holds her It's okay. It's me. It's me. It's me. Look, look. turns her head to face him It's me.
Ellie: sobbing He tried to…
Joel: hugs her tight, comforts her Oh, baby girl… It's okay. It's okay. It's okay now.
The second time he calls her "baby girl" is when he is carrying unconscious Ellie out of the operating room before the doctors can kill her:
Come on, baby girl. I got you. I got you.
Once he is out of there, he even shoots Marlene who begs for her life to keep Ellie safe:
You'd just come after her.
All of this suggests that he is by the end deeply attached to Ellie and very afraid of losing her.
The conclusion of these two reasons is that Joel has no other choice but to lie to Ellie. If he had told her the truth she probably would have gone back to the Fireflies to finish her mission and die so they could extract the cure from her.
Even if Joel had managed to prevent her from leaving she would have despised him for taking away her chance to redeem her guilt. This would have made it very difficult to maintain a healthy relationship with her.
It is left unclear whether Ellie actually believes the lie. The game ends on a very doubting looking Ellie suggesting that she knows she is being lied to. My interpretation is that she knows but also sees that Joel is very attached to her and understands why he lies. Maybe his words in their final conversation also moved her to let go of her initial mission to help find the cure.
Joel: I struggled for a long time with survivin'. And you— No matter what, you keep finding something to fight for.
Ellie's well being gives Joel's life meaning and purpose, something to fight for; Ellie is his "raison d'etre" if you will.