Often my group stands in a line and fire ranged attacks through each others' square to attack enemies ahead. Are there any rules for this, can ranged attacks like arrows and area-of-effect attacks harm allies?
Allies have, by default, absolutely no impact on ranged attacks against your enemies. If an attack targets one creature, it targets one creature, without hurting your allies in between.
Area of effect attacks are a different matter. If the attack targets each creature (as opposed to each enemy) in the area, then your allies are targeted as well and must face the attack roll like the enemies.
As for possible effects on targeting, see Player's Handbook 1, page 280, on rules of cover and concealment:
When you make a ranged attack against an enemy and other enemies are in the way, your target has cover. Your allies never grant cover to your enemies, and neither allies nor enemies give cover against melee, close, or area attacks.
As a related note, I've always considered bonuses like Ranger's Prime Shot that grant bonuses for being the closest to the target to represent the liberty you have when not having to worry about hitting your team-mates (in-universe).
In D&D 4e allies are supposed to move in their square in a way that does not hamper your line of fire.
Conseuqently, only enemies provide cover to your target.
Area of Effect spells only need line of effect between you and the source of your Burst and from the Burst source to the target (PHB p.272). Not even enemies or obstacles can provide cover bonuses, so allies are not an exception.
Be aware that some Close or Area attacks have "Target: all creatures in the blast/burst", which means allies caught in the area risk being hit as well (roll to hit even for them).