I cannot define a length that qualifies a long sentence. Twenty words may seem a lot to you, or forty, or a hundred. You know that this is a short sentence. But you also understand, assuming you have enough experience with the English language, that this sentence, grammatically correct, is a long sentence (and it has twenty-seven words). The danger with long sentences is that they can conquer the writer—the amateur loses control of structure, grammar, voice, or the central idea. Some fiction writers think stream of consciousness implies long sentences. Bad writers have heard that Jame Joyce wrote a twenty-something page sentence (not grammatically correct), and therefore all they have to do is to write their thoughts without any period. That's not how it works. Joyce perfectly understood the language he used and was an accomplished author before he attempted the windingly long sentence. Bad attempts at long sentences sound like James Joyce without his beauty or control. Here is a bad long sentence:
I read in the newspaper somewhere, though I completely forgot where it was, that usually the best way for people in their mid-twenties to get into the stock market is to go on an online trading website, so I set up an account a while ago and started buying stocks, and a day ago I logged on and found that I had actually lost all my money, and I really just stared at the screen like that.
It was a small classroom and a bright day, and he sat at his high seat before a black chalkboard while his pupils marched into the room and to their seats surrounded on all sides by the peach white of the plaster walls.
There are a few tips, besides a firm grasp of grammar, that can help you form a long sentence. These are not habits to avoid, but to avoid overusing.
Polysyndeton: A literary device that employs and instead of commas or sentence breaks. I ran and shot and ducked and fell and rolled into a hole that belonged to gnomes, and that's why I know gnomes are real. It works now and then, better on a small scale. Polysyndeton speeds the pace of the sentence due to the lack of commas and works well for high-paced scenes. But overused, it's a clear sign of an amateur.
Anaphora: This defines the repetition of a word or phrase: I crush the walnut, I crush the enemy, and I crush their dreams. When used well, the repeated word or phrase holds an important meaning; when used poorly, as in my example, it's just a repeated word that dulls the reading experience.
Semicolons: I visited the record store, which I never do; flipped through their classical selection; bought a Liszt record; paid the clerk, who had long curly hair that looked like it hadn't been washed in a week; went home; and played the record. Remember what I said about polysyndeton? Same thing applies here, with semicolons instead of and.
Parenthetical: A parenthetical, like this phrase, is something that goes to further describe or explain part of a sentence, but is not necessary. A long sentence, something over forty words, which is hard to do well, is a beautiful thing, like a butterfly, in the English language, one of many languages. I'm almost embarrassed at how bad that bad example is. Too many parenthetical phrases make a sentence convoluted.
Unfortunately those tips do not conjure a good sentence; there is no equation for good long sentences. They are learned through reading and writing and practice. The above tips should not always be avoided, but used with caution and purpose. Like the long shot in film, the long sentence is a thing of beauty that should not be abused without purpose. Take a few examples before you leave:
My very photogenic mother died in a freak accident (picnic, lightning) when I was three, and, save for a pocket of warmth in the darkest past, nothing of her subsists within the hollows and dells of memory, over which, if you can still stand my style (I am writing under observation), the sun of my infancy had set: surely, you all know those redolent remnants of day suspended, with the midges, about some hedge in bloom or suddenly entered and traversed by the rambler, at the bottom of a hill, in the summer dusk; a furry warmth, golden midges. -Vladimir Nabokov, Lolita
Its vanished trees, the trees that had made way for Gatsby’s house, had once pandered in whispers to the last and greatest of all human dreams; for a transitory enchanted moment man must have held his breath in the presence of this continent, compelled into an aesthetic contemplation he neither understood nor desired, face to face for the last time in history with something commensurate to his capacity for wonder. -F. Scott Fitzgerald, The Great Gatsby
It creeped him out, the way it just sat there looking so plastic and harmless among the old-time good intentions of all that downtown architecture, no more sinister than a chain motel by the freeway, and yet behind its neutral drapes and far away down its fluorescent corridors it was swarming with all this strange alternate cop history and cop politics—cop dynasties, cop heroes and evildoers, saintly cops and psycho cops, cops too stupid to live and cops too smart for their own good—insulated by secret loyalties and codes of silence from the world they'd all be given to control, or, as they liked to put it, protect and serve. -Thomas Pynchon, Inherent Vice