To all of those who are not native Texans, allow me to explain why he got closer than any in Texas. Over the last 5 or so years, Texas has received a massive influx of Californians and Mexican immigrants, both of which vote overwhelming democrat. Beto is not changing anyone's minds, he's benefiting from a change in demographics. If these changes in the population continue, which there's no reason to suspect they wouldn't, Texas will flip by the next house/senate/etc race.
As I said, the fact that he had massive out of state funding, is going up against a republican that even some in his own voter base dislike, and is benefiting from the aforementioned demographic changes, it's obvious why Beto came "close."
And you have to understand just how bad Cruz's push was. My family and most of our friends/acquaintances vote consistently Republican, and there was no Cruz fanfare. You couldn't drive anywhere without seeing slews of Beto signs since at least 2 months ago. The Cruz signs only popped up right after the Kavanaugh hearings ended, and they were dwarfed 3 to 1 by Beto signs, yet Cruz got more votes. I had to go out of my way to look into Cruz's campaign, because no one was talking about him, but Beto was the opposite case. I think the republican primaries actually hurt his image in the eyes of his own party, because nothing about this tells me he's still popular with his party.
Beto should've had an easy win but failed. And had he won, I think he'd have a good shot at defeating Trump. But I just don't see how someone with a losing streak will beat him, when you know Trump will never not draw attention to it, and unlike much of what he says, he'll be right this time.