A police officer can ask you for your phone number. I don't see what would prohibit them from doing so. I can't really speculate as to why he would ask you for that phone number though.
However, what you need to know is that you never have to answer questions from the police about anything. You can, and always should, politely decline to answer any questions unless you speak with your attorney first. I know it seems strange to do this in a traffic ticket situation, but, it is the best thing to do and the only way to protect you from being asked unnecessary questions by police.
During a traffic stop, you need only to provide the documents the officer requests - like DL, insurance and registration. In some states you don't even need to produce a registration.
So, moral of the story is, tell the officer you wish to remain silent and you need an attorney if he/she is going to ask you anymore questions.
Best of luck,
Do you mean ask you for your number like in a date-type sense? There are generally departmental policies against this although I don't know that there is a law against it. You should check with the department. If you feel the officer was harassing you or propositioning you, you should report it. If you feel he was flirting with you and it was inappropriate or made you uncomfortable considering the circumstances, you should report it.
You should report this behavior to internal affairs. This would be the "right thing to do". However, it might not be worth your time and trouble especially considering that it may or may not be "your word against his" you might not see any results or gain any satisfaction.
It is not acceptable behavior and most officers would be upset with an fellow officer doing such a thing.