Elon Musk offered Amber Heard “24/7 security” after she told him she wanted a restraining order against Johnny Depp, the High Court has heard.
She denied Mr Musk visited her while her then-husband Mr Depp was away.
Mr Depp, 57, is suing the publisher of the Sun over an article that labelled him a “wife beater” – but the newspaper insists it was accurate.
He denies 14 allegations of domestic violence on which News Group Newspapers is relying for its defence.
The US actress, 34, was giving evidence for a second day at London’s High Court on the 11th day of her ex-husband’s libel action.
She dismissed suggestions Mr Musk visited her in 2015 while Mr Depp was away, saying she was not in touch with the Tesla founder until the following year.
On Tuesday, Mr Depp’s lawyer, Eleanor Laws QC, questioned Ms Heard on her statement, in which the lawyer said the actress had indicated that Mr Depp was “illogically jealous” and that she wasn’t having any “illicit relationships”.
The trial judge, Mr Justice Nicol, intervened to say the word “illicit… carries a connotation”.
Ms Heard replied: “Not that that matters much, but no.”
Ms Laws agreed: “No, it doesn’t.”
The lawyer then read out text messages between Ms Heard and Mr Musk from 22 May 2016, in which Ms Heard tells Mr Musk that she is going to obtain a restraining order against her then husband.
The messages came a day after an alleged incident at the Eastern Columbia Building in Los Angeles, where Mr Depp and Ms Heard lived, in which the actress claims Mr Depp threw her mobile phone at her, hitting her in the face – which the actor denies.
Questioning Ms Heard, Ms Laws said Mr Musk offers to “arrange 24/7 security for you”, adding: “The offer would stand, even if you never wanted to see me again… anyway, sorry for being an idiot. The radio silence hurts a lot. It only matters because I really like you.”
The barrister then referred to evidence given by Alejandro Romero, a concierge at the Eastern Columbia Building, who said he saw Mr Musk visiting Ms Heard “when Mr Depp was in Australia”.
Ms Heard said Mr Romero was “wrong”, insisting that she wasn’t in communication with Mr Musk until 2016.
In his written witness statement, Mr Romero said: “From March 2015 onwards, Ms Heard was visited regularly late at night, at around 11pm to midnight, by Mr Elon Musk.”
The concierge claimed Ms Heard gave Mr Musk his own fob to access the building.
Ms Heard has said that Mr Depp accused her of having affairs with fellow actors, including James Franco – with whom she starred in the film The Adderall Diaries.
Mr Depp’s lawyer asked Ms Heard about Mr Franco and her comment in her statement that he was “someone that Mr Depp was accusing you of having an affair with and he was quite wrong about it”.
Ms Heard said: “That’s right.”
The lawyer showed the court CCTV footage of the actress travelling downstairs in the lift at the Eastern Columbia Building on 22 May 22 2016 at around 23:00 local time (06:00 BST), before travelling back upstairs shortly after with Mr Franco.
After Ms Heard confirmed that the man in the footage was Mr Franco, Ms Laws asked her if she was trying to “avoid” being seen by the camera.
Ms Heard replied that the pair were “talking” and Mr Franco was saying to her “‘oh my god, what happened to you?’ when he saw her face.
Ms Heard said she collected Mr Franco from downstairs after 23:00 local time, before adding that “in those days, I didn’t sleep much at night”.
The libel case centres on an article published on the Sun’s website in April 2018 headlined: “Gone Potty: How can JK Rowling be ‘genuinely happy’ casting wife beater Johnny Depp in the new Fantastic Beasts film?”.
The article related to allegations made by Ms Heard.
Her evidence was initially due to conclude on Wednesday but will now continue until Thursday morning, with her friends Melanie Inglessis and Joshua Drew expected to appear by videolink on Wednesday afternoon.