Basically, you were caught with weed in your pocket. They can prove possession, but they can't prove intent to distribute.
Right off the bat, we have 2 issues here.
First, when you demanded to exercise your right to remain silent, the cop chose to keep talking to you. So anything that took place after you told him that cannot be used against you (assuming that you get a lawyer who insists on this).
Second, and most obvious, what is the probable cause for the cop to come and ask you questions? The police don't have a right to just come up to your car and question you/search your vehicle. This is considered detaining you, and they need probable cause. If you were speeding, failed to stop at a stop sign, your car was reported stolen, etc, then there is a reason. But otherwise, any evidence obtained from this should be suppressed.
As far as lying to you to tell you that there were text messages on your phone, that is very typical. All cops are liars. This is what they do.
There is no use arguing with a cop or denying anything. Just don't say anything. Once they have arrested you, there is absolutely nothing that you can tell them that will make them let you go.
So your friend will be in a world of trouble because they got him to admit that he was in possession. If he gets a good lawyer, they can throw this whole thing out because of the unlawful search (no probable cause). If not, then the prosecutor will make him a plea agreement. He pleads guilty and gets probation or a year or 30 days or whatever is typical.
And they will really offer you the same deal. You are in a better situation because you didn't talk. But they will consider you to be in possession of all of the weed as well. The one joint that you have just makes it even easier to prove it.
If you get a good lawyer, they will either agree to drop the charges in exchange for nothing, or if they think that the case is weak, and your friend doesn't accept their deal, then you will testify against your friend.
If you were in America, I would suggest this lawyer:
http://www.potlawyer.com/
But in Canada, there is only one man for the job:
http://www.craigpenney.com/