It's certainly safer than leaving the king in the middle of the board (in most cases).
what way should your pawns in front of king be organized when you castle

Safest is the pawns that haven't advance. Any advance creates a weakness.
That's not to say you should never advance them, sometimes it's a necessary defensive measure.
Your losses are unlikely to be because of the position of the pawns. More likely you missed a few attacking ideas of your opponent. It's probably best to look at a specific game to see which mistakes you made.

As Scottrf said, three pawns that haven't advanced is safest. He also mentions looking at specific games to see what went wrong. I hope you don't mind, but I took a look at your recent games and chose one that seems to fit.
So as we see from this game, you didn't lose because castling is inherently bad. You lost because you castled to where your opponent was strongest. And the reason your opponent was stronger there is because you wasted time making idle checks with your queen while your opponent developed with tempo.
If you had castled queenside in that game, your opponent would have had a harder time getting to your king, and you would have had time to catch up again in development.
As Scottrf said, three pawns that haven't advanced is safest. He also mentions looking at specific games to see what went wrong. I hope you don't mind, but I took a look at your recent games and chose one that seems to fit.
So as we see from this game, you didn't lose because castling is inherently bad. You lost because you castled to where your opponent was strongest. And the reason your opponent was stronger there is because you wasted time making idle checks with your queen while your opponent developed with tempo.
If you had castled queenside in that game, your opponent would have had a harder time getting to your king, and you would have had time to catch up again in development.
Would it be better to trade queens rather than play 9.Kf8?

@analyzethispgn wrote:
"... everyone advises castling early ..."
-----
Very wrong, as a general rule.
I don't know about that...
There is nothing wrong with castling... In general, it develops rook and build fortress for your King... but if your development is not quick and all other basics thing then everything will go wrong... You need to be ahead in development, always look for double attack and initiative moves, forcing moves, or look for pin and skew and lots more tactics....

AndyClifton wrote:
Very wrong, as a general rule.
I don't know about that...
-----
Of course you can disagree with me. But I do know: you should castle in time, not a.s.a.p..
For a player who can't tell when the right time is, early is generally better than late.
seems to me if you castle K side you need to get the h file pawn one forward pretty smartish to be safe. Q side not sure.
Thanks lads for all the replies. They have been a big help. Ive no probblem with anyone looking through the games. The more help the better. In that game with Jorfenk I was caught up in making checks and attacking and took my eye off the ball. I never seen the effect the Bishop on b7 would have when working with the Queen against the flat 3 pawns. That has caught me on 2 or 3 occasions

@analyzethispgn wrote:
"... everyone advises castling early ..."
-----
Very wrong, as a general rule.
Many slightly advanced players (1300 - 1750) often castle too early.
In particular openings castling early takes away an important option, to open the rook file. It can also give away important strategic info to your opponent to early, because he knows where to attack immediately.
There are lots of reasons one should castle early. For example, here Chigorin equalizes against steinitz as early as move 8 because Steinitz had not castled. (Steinitz Chigorin WC rematch game 2, 1892, 1/2-1/2)

@analyzethispgn wrote:
"... everyone advises castling early ..."
-----
Very wrong, as a general rule.
Many slightly advanced players (1300 - 1750) often castle too early.
In particular openings castling early takes away an important option, to open the rook file. It can also give away important strategic info to your opponent to early, because he knows where to attack immediately.
Many grandmasters tend to castle later than us club players. And every so often, they pay dearly for that delay.
I used to have a friend who said he would one day gether every GM in the world into a classroom, sit them down, stand up at the chalkboard, and say:
It goes like this!
Step one: move your knight!
Step two: move your bishop!
Step three: castle!
Again!
Step one....
In the early middle game, the position reached after king side castling with the three pawns in front of the king undisturbed and a knight on f3 (for white) or f6 (for black) is considered to confer the greatest degree of king safety and that view matches my own otb experience.What the pawns are doing is simply to block all the files and diagonals that lead towards the king. To get one or more of them out of the way requires either a piece to be sacrificed (by taking one of the pawns and being recaptured, probably by the king) or for enemy pawns to be advanced far enough to get into contact with the blocking pawns (called a pawn storm) or for two or more enemy pieces to combine together both to attack one of the pawns.
A pawn storm takes quite a number of moves (not advancing your own pawns leaves your enemy with the maximum ground to cover to reach them) and you will be able to use that time to make an attack of your own. Sometimes your attack will be on the other wing (the queen side if you castled king side) sometimes it will be in the centre. It is worth knowing that the most effective counter to an attack on either wing is said to be a counter attack in the centre but active, aggressive counter play anywhere on the board is what you look for. If your opponent's pawn storm gets to your pawns before your counterplay forces him to move his attention away you will find yourself advancing one or other of your three blocking pawns - to avoid that pawn being exchanged or to block the further advance of an enemy pawn. Try to delay moving any of the pawns as long as possible, but if the time comes when you must move one (I am afraid judging when that time has come requires quite a lot of experience but it is not rocket science) what you will find is that there is a great deal of latent defensive potential in the starting position. It regularly happens that an attacker conducting a pawn storm spends three, four or five moves steadily advancing his pawns only to have the whole attack stalled and a closed pawn position created by just one well judged pawn move by the defender. (By closed position I mean one in which no pawns can be exchanged).
Turning to a combinative attack the most obvious example is the attack by queen and bishop (as in scholars mate or the fried liver) beloved of beginners. As with pawn storms it takes some moves for your opponent to get his combination together. That affords you time either to attack yourself or to organise effective defence. And again the technique is to delay disturbing your pawns as long as you can but to stand ready to blunt the enemy attack by advancing one of them - typically the rook or knight pawn advancing one square or the bishop pawn (if your knight has been exchanged or driven away) advancing two squares.
But don't do this unless driven to it. While the pawns stay at home they keep their options open, are less easy targets and they command all the important third rank squares. So as your opponent manoevres pieces to get his combination attack on one of the pawns you manoevre your own pieces to meet the threat or to create counter threats of your own. Again it is worth remembering that some attacking stroke by you in the centre is likely to be quicker and more effective than your opponent's attempt to generate play on the king's wing.
So to sum up, keeping the pawns in front of the king at home blocks off all the lines to your king; keeps all the pawns' options open; offers no target; does nothing to speed up the exchange of these pawns; and controls all the squares on the third rank.

Castling alone does not prevent mate, but it helps you to organize the defense.
Some adavantages of castling:
- the pawn shield protects your king from checks
- the King can be attacked from only one direction
- it develops your rook
Often players put 1 or 2 pieces in front of the pawnshield to strengthen the position of the king, depending on your opponents threats. Usually a knight on f3 (sometimes f1) to protect h2, and/or a knight/bishop on g3 ...
Reasons not to castle:
- your opponent will know where your king will be, so you might want to delay castling sometimes
- in positions without queens your king might be better placed in the center

I have a friend I have been trying to teach chess. But the problem I have is, he swears castling is a mistake.
"When I castle, my king gets trapped in a corner, and makes it easier for my opponent to mate me."
So I try to pound it into him he's gotta castle. He does, and gets mated. "See? My king was better in the center!"
To make matters worse, he is just as bull-headed as I am.
I have run out of ways to word the benefits of castling.

I have a friend I have been trying to teach chess. But the problem I have is, he swears castling is a mistake.
"When I castle, my king gets trapped in a corner, and makes it easier for my opponent to mate me."
So I try to pound it into him he's gotta castle. He does, and gets mated. "See? My king was better in the center!"
To make matters worse, he is just as bull-headed as I am.
I have run out of ways to word the benefits of castling.
It's easy, the best chess player in the history of planet earth (Stockfish) routinely castles.

there are many safe pawn structures.
there are a few more and all have their strengths and weaknesses but these are the most common.

I recall playing over, long ago, a game in which a player castled rather routinely, virtually reflexively, and right into a violent attack. I have never forgotten the annotator's comment: "Castle if you will or if you must, not if you can." Words to live by. Are you castling to safety or are you, as they say, "castling into it"?
Of course, in the great majority of games it is wise to castle during the opening phase, both to activate a rook (and facilitate the linking up of one's rooks along the back rank) and also to get the king out of the shooting gallery in the center files of the full board.
When there has been a substantial reduction in pieces, most especially when the queens have been exchanged early, one can always consider keeping the king in the center, as mating threats are diminished and the king is transformed from a target to a strong piece.
More than forty years later I still remember with pleasure winning a game like that, and a tournament, because in the last round my opponent, a strong Class A player, castled automatically when there was no longer need for it, and I activated my rooks on the back row by playing Kd2, centralizing His Majesty instead of tucking him into a corner. The position was otherwise level and my opponent lost because his king, on g8, was too far from the endgame action. Essentially he was playing a piece down.
Keep useful axioms, rules of thumb, and positional guidelines in mind, but always try to think for yourself and look at the position that is before you.
As above. I have been checkmated a few times by getting trapped in a corner after castling.
Normally my pawns are a flat 3 in front of the king.
I dont think this is very secure yet everyone advises castling early.
What am I doing wrong. I really dont see much of an advantage to castling in terms of safety. The only + I see to castling is you can a rook activated easier but I dont think its very safe.
It also tells your opponent where he should direct his attack.
Thanks for any help with this Qs.