Both are good routes to secure a first interview; after that, you're on your own in most cases.
All things being equal, I'd go via the referral route -- it lets your friend put in a good word for you, potentially earns your friend a bounty, and saves the company the recruiter's fee.